Merge "update flags.mk to create one storage file per rule" into main am: 00f4643347

Original change: https://android-review.googlesource.com/c/platform/build/+/2925170

Change-Id: I39c10d3f0a4b0bcb3168dac8be5321a6ed8f47e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Dennis Shen
2024-01-25 15:10:13 +00:00
committed by Automerger Merge Worker

View File

@@ -98,36 +98,55 @@ $(foreach partition, $(_FLAG_PARTITIONS), \
) )
# Create a set of storage file for each partition # Create a set of storage file for each partition
# $(1): built aconfig flags storage dir (out) # $(1): built aconfig flags storage package map file (out)
# $(2): installed aconfig flags storage package map file (out) # $(2): built aconfig flags storage flag map file (out)
# $(3): installed aconfig flags storage flag map file (out) # $(3): built aconfig flags storage flag val file (out)
# $(4): installed aconfig flags storage flag value file (out) # $(4): installed aconfig flags storage package map file (out)
# $(5): input aconfig files for the partition (in) # $(5): installed aconfig flags storage flag map file (out)
# $(6): installed aconfig flags storage flag value file (out)
# $(7): input aconfig files for the partition (in)
define generate-partition-aconfig-storage-file define generate-partition-aconfig-storage-file
$(eval $(strip $(1))/target: PRIVATE_OUT_DIR := $(strip $(1))) $(eval $(strip $(1)): PRIVATE_OUT := $(strip $(1)))
$(eval $(strip $(1))/target: PRIVATE_IN := $(strip $(5))) $(eval $(strip $(1)): PRIVATE_IN := $(strip $(7)))
$(strip $(1))/target: $(ACONFIG) $(strip $(5)) $(strip $(1)): $(ACONFIG) $(strip $(7))
mkdir -p $$(PRIVATE_OUT_DIR) mkdir -p $$(dir $$(PRIVATE_OUT))
$$(if $$(PRIVATE_IN), \ $$(if $$(PRIVATE_IN), \
$$(ACONFIG) create-storage --container "" --out $$(PRIVATE_OUT_DIR) \ $$(ACONFIG) create-storage --container "" --file package_map --out $$(PRIVATE_OUT) \
$$(addprefix --cache ,$$(PRIVATE_IN)), \ $$(addprefix --cache ,$$(PRIVATE_IN)), \
) )
echo -n > $$(PRIVATE_OUT_DIR)/target touch $$(PRIVATE_OUT)
$(strip $(1))/package.map: $(strip $(1))/target $(eval $(strip $(2)): PRIVATE_OUT := $(strip $(2)))
$(strip $(1))/flag.map: $(strip $(1))/target $(eval $(strip $(2)): PRIVATE_IN := $(strip $(7)))
$(strip $(1))/flag.val: $(strip $(1))/target $(strip $(2)): $(ACONFIG) $(strip $(7))
$(call copy-one-file, $(strip $(1))/package.map, $(2)) mkdir -p $$(dir $$(PRIVATE_OUT))
$(call copy-one-file, $(strip $(1))/flag.map, $(3)) $$(if $$(PRIVATE_IN), \
$(call copy-one-file, $(strip $(1))/flag.val, $(4)) $$(ACONFIG) create-storage --container "" --file flag_map --out $$(PRIVATE_OUT) \
$$(addprefix --cache ,$$(PRIVATE_IN)), \
)
touch $$(PRIVATE_OUT)
$(eval $(strip $(3)): PRIVATE_OUT := $(strip $(3)))
$(eval $(strip $(3)): PRIVATE_IN := $(strip $(7)))
$(strip $(3)): $(ACONFIG) $(strip $(7))
mkdir -p $$(dir $$(PRIVATE_OUT))
$$(if $$(PRIVATE_IN), \
$$(ACONFIG) create-storage --container "" --file flag_val --out $$(PRIVATE_OUT) \
$$(addprefix --cache ,$$(PRIVATE_IN)), \
)
touch $$(PRIVATE_OUT)
$(call copy-one-file, $(strip $(1)), $(4))
$(call copy-one-file, $(strip $(2)), $(5))
$(call copy-one-file, $(strip $(3)), $(6))
endef endef
ifeq ($(RELEASE_CREATE_ACONFIG_STORAGE_FILE),true) ifeq ($(RELEASE_CREATE_ACONFIG_STORAGE_FILE),true)
$(foreach partition, $(_FLAG_PARTITIONS), \ $(foreach partition, $(_FLAG_PARTITIONS), \
$(eval aconfig_storage_package_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/package.map) \ $(eval aconfig_storage_package_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/package.map) \
$(eval aconfig_storage_flag_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.map) \ $(eval aconfig_storage_flag_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.map) \
$(eval aconfig_storage_falg_value.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.val) \ $(eval aconfig_storage_flag_val.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.val) \
$(eval $(call generate-partition-aconfig-storage-file, \ $(eval $(call generate-partition-aconfig-storage-file, \
$(TARGET_OUT_FLAGS)/$(partition), \ $(TARGET_OUT_FLAGS)/$(partition)/package.map, \
$(TARGET_OUT_FLAGS)/$(partition)/flag.map, \
$(TARGET_OUT_FLAGS)/$(partition)/flag.val, \
$(aconfig_storage_package_map.$(partition)), \ $(aconfig_storage_package_map.$(partition)), \
$(aconfig_storage_flag_map.$(partition)), \ $(aconfig_storage_flag_map.$(partition)), \
$(aconfig_storage_flag_val.$(partition)), \ $(aconfig_storage_flag_val.$(partition)), \