Merge "Fix GET-INSTALL-PATH to work with Soong"

am: 6b9aa6938d

Change-Id: I9f433cb383846ec6ccb8e39be4b30110d60d54fd
This commit is contained in:
Dan Willemsen 2016-08-15 21:17:33 +00:00 committed by android-build-merger
commit 9fc9cac0ac
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
# 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

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
# 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

View File

@ -527,11 +527,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
@ -918,20 +935,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)

View File

@ -81,9 +81,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))))

View File

@ -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