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
This commit is contained in:
Dan Willemsen 2016-08-11 17:20:33 -07:00
parent 6d64ff1bf7
commit 53e3899222
5 changed files with 30 additions and 27 deletions

View File

@ -105,4 +105,4 @@ endif
# variable will be changed. After you have modified this file with the new # 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 # changes (see buildspec.mk.default), update this to the new value from
# buildspec.mk.default. # buildspec.mk.default.
BUILD_ENV_SEQUENCE_NUMBER := 11 BUILD_ENV_SEQUENCE_NUMBER := 12

View File

@ -20,7 +20,7 @@ include $(BUILD_SYSTEM)/version_defaults.mk
# people who haven't re-run those will have to do so before they # 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 # can build. Make sure to also update the corresponding value in
# buildspec.mk.default and envsetup.sh. # 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 # The product defaults to generic on hardware

View File

@ -532,11 +532,28 @@ NOTICE-HOST-%: ;
NOTICE-TARGET-%: ; NOTICE-TARGET-%: ;
# A helper goal printing out install paths # A helper goal printing out install paths
.PHONY: GET-INSTALL-PATH define register_module_install_path
GET-INSTALL-PATH: .PHONY: GET-MODULE-INSTALL-PATH-$(1)
@echo "Install paths for modules in $(ONE_SHOT_MAKEFILE):" GET-MODULE-INSTALL-PATH-$(1):
@$(foreach m, $(ALL_MODULES), $(if $(ALL_MODULES.$(m).INSTALLED), \ echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)'
echo 'INSTALL-PATH: $(m) $(ALL_MODULES.$(m).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 else # ONE_SHOT_MAKEFILE
@ -923,20 +940,6 @@ vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
.PHONY: bootimage .PHONY: bootimage
bootimage: $(INSTALLED_BOOTIMAGE_TARGET) 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 .PHONY: auxiliary
auxiliary: $(INSTALLED_AUX_TARGETS) auxiliary: $(INSTALLED_AUX_TARGETS)

View File

@ -79,9 +79,6 @@ endif
ifneq ($(ONE_SHOT_MAKEFILE),) ifneq ($(ONE_SHOT_MAKEFILE),)
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE)) KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE))
endif 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_checksum_suffix :=
my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64)))) my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64))))

View File

@ -290,7 +290,7 @@ function set_stuff_for_environment()
function set_sequence_number() function set_sequence_number()
{ {
export BUILD_ENV_SEQUENCE_NUMBER=11 export BUILD_ENV_SEQUENCE_NUMBER=12
} }
function settitle() function settitle()
@ -789,7 +789,8 @@ function mm()
done done
if [ -n "$GET_INSTALL_PATH" ]; then if [ -n "$GET_INSTALL_PATH" ]; then
MODULES= MODULES=
ARGS=GET-INSTALL-PATH ARGS=GET-INSTALL-PATH-IN-$(dirname ${M})
ARGS=${ARGS//\//-}
else else
MODULES=MODULES-IN-$(dirname ${M}) MODULES=MODULES-IN-$(dirname ${M})
# Convert "/" to "-". # Convert "/" to "-".
@ -816,6 +817,7 @@ function mmm()
local DIR TO_CHOP local DIR TO_CHOP
local DIR_MODULES local DIR_MODULES
local GET_INSTALL_PATH= local GET_INSTALL_PATH=
local GET_INSTALL_PATHS=
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/') local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/') local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
for DIR in $DIRS ; do for DIR in $DIRS ; do
@ -827,6 +829,7 @@ function mmm()
if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
if [ "$DIR_MODULES" = "" ]; then if [ "$DIR_MODULES" = "" ]; then
MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR" MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR"
GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$DIR"
else else
MODULES="$MODULES $DIR_MODULES" MODULES="$MODULES $DIR_MODULES"
fi fi
@ -854,7 +857,7 @@ function mmm()
fi fi
done done
if [ -n "$GET_INSTALL_PATH" ]; then if [ -n "$GET_INSTALL_PATH" ]; then
ARGS=$GET_INSTALL_PATH ARGS=${GET_INSTALL_PATHS//\//-}
MODULES= MODULES=
MODULES_IN_PATHS= MODULES_IN_PATHS=
fi fi