From 53e3899222a7c49721e5b2be13cadbbf3b66c721 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Thu, 11 Aug 2016 17:20:33 -0700 Subject: [PATCH] Fix GET-INSTALL-PATH to work with Soong This was printing all of the Soong modules in addition to the modules defined in the ONE_SHOT_MAKEFILE. So replicate what we did with MODULES-IN-* with GET-INSTALL-PATH-IN-* and update all the users. Bug: 30191725 Change-Id: Ib1e4bf00f64d7a3e8cd91f44eaf1ff82fdfbf162 --- buildspec.mk.default | 2 +- core/envsetup.mk | 2 +- core/main.mk | 41 ++++++++++++++++++++++------------------- core/ninja.mk | 3 --- envsetup.sh | 9 ++++++--- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/buildspec.mk.default b/buildspec.mk.default index 714344ca4..a7ac7ec96 100644 --- a/buildspec.mk.default +++ b/buildspec.mk.default @@ -105,4 +105,4 @@ endif # variable will be changed. After you have modified this file with the new # changes (see buildspec.mk.default), update this to the new value from # buildspec.mk.default. -BUILD_ENV_SEQUENCE_NUMBER := 11 +BUILD_ENV_SEQUENCE_NUMBER := 12 diff --git a/core/envsetup.mk b/core/envsetup.mk index f2347020d..a0e322a10 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -20,7 +20,7 @@ include $(BUILD_SYSTEM)/version_defaults.mk # people who haven't re-run those will have to do so before they # can build. Make sure to also update the corresponding value in # buildspec.mk.default and envsetup.sh. -CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 11 +CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 12 # --------------------------------------------------------------- # The product defaults to generic on hardware diff --git a/core/main.mk b/core/main.mk index 372097106..36195c461 100644 --- a/core/main.mk +++ b/core/main.mk @@ -532,11 +532,28 @@ NOTICE-HOST-%: ; NOTICE-TARGET-%: ; # A helper goal printing out install paths -.PHONY: GET-INSTALL-PATH -GET-INSTALL-PATH: - @echo "Install paths for modules in $(ONE_SHOT_MAKEFILE):" - @$(foreach m, $(ALL_MODULES), $(if $(ALL_MODULES.$(m).INSTALLED), \ - echo 'INSTALL-PATH: $(m) $(ALL_MODULES.$(m).INSTALLED)';)) +define register_module_install_path +.PHONY: GET-MODULE-INSTALL-PATH-$(1) +GET-MODULE-INSTALL-PATH-$(1): + echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)' +endef + +SORTED_ALL_MODULES := $(sort $(ALL_MODULES)) +UNIQUE_ALL_MODULES := +$(foreach m,$(SORTED_ALL_MODULES),\ + $(if $(call streq,$(m),$(lastword $(UNIQUE_ALL_MODULES))),,\ + $(eval UNIQUE_ALL_MODULES += $(m)))) +SORTED_ALL_MODULES := + +$(foreach mod,$(UNIQUE_ALL_MODULES),$(if $(ALL_MODULES.$(mod).INSTALLED),\ + $(eval $(call register_module_install_path,$(mod)))\ + $(foreach path,$(ALL_MODULES.$(mod).PATH),\ + $(eval my_path_prefix := GET-INSTALL-PATH-IN)\ + $(foreach component,$(subst /,$(space),$(path)),\ + $(eval my_path_prefix := $$(my_path_prefix)-$$(component))\ + $(eval .PHONY: $$(my_path_prefix))\ + $(eval $$(my_path_prefix): GET-MODULE-INSTALL-PATH-$(mod)))))) +UNIQUE_ALL_MODULES := else # ONE_SHOT_MAKEFILE @@ -923,20 +940,6 @@ vendorimage: $(INSTALLED_VENDORIMAGE_TARGET) .PHONY: bootimage bootimage: $(INSTALLED_BOOTIMAGE_TARGET) -# phony target that include any targets in $(ALL_MODULES) -.PHONY: all_modules -ifndef BUILD_MODULES_IN_PATHS -all_modules: $(ALL_MODULES) -else -# BUILD_MODULES_IN_PATHS is a list of paths relative to the top of the tree -build_modules_in_paths := $(patsubst ./%,%,$(BUILD_MODULES_IN_PATHS)) -module_path_patterns := $(foreach p, $(build_modules_in_paths),\ - $(if $(filter %/,$(p)),$(p)%,$(p)/%)) -my_all_modules := $(sort $(foreach m, $(ALL_MODULES),$(if $(filter\ - $(module_path_patterns), $(addsuffix /,$(ALL_MODULES.$(m).PATH))),$(m)))) -all_modules: $(my_all_modules) -endif - .PHONY: auxiliary auxiliary: $(INSTALLED_AUX_TARGETS) diff --git a/core/ninja.mk b/core/ninja.mk index 069a43e80..2e538f563 100644 --- a/core/ninja.mk +++ b/core/ninja.mk @@ -79,9 +79,6 @@ endif ifneq ($(ONE_SHOT_MAKEFILE),) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE)) endif -ifneq ($(BUILD_MODULES_IN_PATHS),) -KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmma-$(call replace_space_and_slash,$(BUILD_MODULES_IN_PATHS)) -endif my_checksum_suffix := my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64)))) diff --git a/envsetup.sh b/envsetup.sh index 3f6131830..53b4a22c9 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -290,7 +290,7 @@ function set_stuff_for_environment() function set_sequence_number() { - export BUILD_ENV_SEQUENCE_NUMBER=11 + export BUILD_ENV_SEQUENCE_NUMBER=12 } function settitle() @@ -789,7 +789,8 @@ function mm() done if [ -n "$GET_INSTALL_PATH" ]; then MODULES= - ARGS=GET-INSTALL-PATH + ARGS=GET-INSTALL-PATH-IN-$(dirname ${M}) + ARGS=${ARGS//\//-} else MODULES=MODULES-IN-$(dirname ${M}) # Convert "/" to "-". @@ -816,6 +817,7 @@ function mmm() local DIR TO_CHOP local DIR_MODULES local GET_INSTALL_PATH= + local GET_INSTALL_PATHS= local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/') local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/') for DIR in $DIRS ; do @@ -827,6 +829,7 @@ function mmm() if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then if [ "$DIR_MODULES" = "" ]; then MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR" + GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$DIR" else MODULES="$MODULES $DIR_MODULES" fi @@ -854,7 +857,7 @@ function mmm() fi done if [ -n "$GET_INSTALL_PATH" ]; then - ARGS=$GET_INSTALL_PATH + ARGS=${GET_INSTALL_PATHS//\//-} MODULES= MODULES_IN_PATHS= fi