<partition>/build.prop rules are defined using macro am: e28fa80e12

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

Change-Id: I6e5bd7a93c6e7fe0e45ca5befb2f110bfb40c4e1
This commit is contained in:
Jiyong Park 2020-06-08 16:04:52 +00:00 committed by Automerger Merge Worker
commit 236859d234
3 changed files with 123 additions and 149 deletions

View File

@ -329,6 +329,8 @@ ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PRODUCT_PRODUCT_VNDK_
endif endif
endif endif
ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
### ###
### In this section we set up the things that are different ### In this section we set up the things that are different

View File

@ -54,8 +54,54 @@ define generate-common-build-props-with-product-vars-set
bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2) bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
endef endef
# Rule for generating <partition>/build.prop file
#
# $(1): partition name
# $(2): path to the output
# $(3): path to the input *.prop files. The contents of the files are directly
# emitted to the output
# $(4): list of variable names each of which contains name=value pairs
# $(5): optional list of prop names to force remove from the output. Properties from both
# $(3) and (4) are affected.
define build-properties
ALL_DEFAULT_INSTALLED_MODULES += $(2)
# TODO(b/117892318): eliminate the call to uniq-pairs-by-first-component when
# it is guaranteed that there is no dup.
$(foreach name,$(strip $(4)),\
$(eval _resolved_$(name) := $$(call collapse-pairs, $$(call uniq-pairs-by-first-component,$$($(name)),=)))\
)
$(2): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3)
$(hide) echo Building $$@
$(hide) mkdir -p $$(dir $$@)
$(hide) rm -f $$@ && touch $$@
$(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
$(hide) $(foreach file,$(strip $(3)),\
if [ -f "$(file)" ]; then\
echo "" >> $$@;\
echo "####################################" >> $$@;\
echo "# from $(file)" >> $$@;\
echo "####################################" >> $$@;\
cat $(file) >> $$@;\
fi;)
$(hide) $(foreach name,$(strip $(4)),\
echo "" >> $$@;\
echo "####################################" >> $$@;\
echo "# from variable $(name)" >> $$@;\
echo "####################################" >> $$@;\
$$(foreach line,$$(_resolved_$(name)),\
echo "$$(line)" >> $$@;\
)\
)
$(hide) $(POST_PROCESS_PROPS) $$@ $(5)
$(hide) echo "# end of file" >> $$@
endef
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# build.prop # system/build.prop
#
intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
@ -258,167 +304,94 @@ $(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop)
$(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@ $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# vendor build.prop # vendor/build.prop
# #
# For verifying that the vendor build is what we think it is _prop_files_ := $(if $(TARGET_VENDOR_PROP),\
INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop $(TARGET_VENDOR_PROP),\
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET) $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
ifdef TARGET_VENDOR_PROP
vendor_prop_files := $(TARGET_VENDOR_PROP)
else
vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)
endif
android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@ cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
vendor_prop_files += $(android_info_prop) _prop_files_ += $(android_info_pro)
ifdef property_overrides_split_enabled ifdef property_overrides_split_enabled
FINAL_VENDOR_BUILD_PROPERTIES += \ # Order matters here. When there are duplicates, the last one wins.
$(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES) $(ADDITIONAL_VENDOR_PROPERTIES)) # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ _prop_vars_ := \
$(FINAL_VENDOR_BUILD_PROPERTIES),=) ADDITIONAL_VENDOR_PROPERTIES \
endif # property_overrides_split_enabled PRODUCT_PROPERTY_OVERRIDES
$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(vendor_prop_files)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@ && touch $@
$(hide) $(call generate-common-build-props,vendor,$@)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
ifdef property_overrides_split_enabled
$(hide) $(foreach file,$(vendor_prop_files), \
if [ -f "$(file)" ]; then \
echo Target vendor properties from: "$(file)"; \
echo "" >> $@; \
echo "#" >> $@; \
echo "# from $(file)" >> $@; \
echo "#" >> $@; \
cat $(file) >> $@; \
echo "# end of $(file)" >> $@; \
fi;)
$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
endif # property_overrides_split_enabled
$(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
# -----------------------------------------------------------------
# product build.prop
INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
ifdef TARGET_PRODUCT_PROP
product_prop_files := $(TARGET_PRODUCT_PROP)
else else
product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop) _prop_vars_ :=
endif endif
FINAL_PRODUCT_PROPERTIES += \ INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
$(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES)) $(eval $(call build-properties,\
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \ vendor,\
$(FINAL_PRODUCT_PROPERTIES),=) $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
$(_prop_files_),\
$(_prop_vars_),\
$(PRODUCT_VENDOR_PROPERTY_BLACKLIST)))
$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files) # -----------------------------------------------------------------
@echo Target product buildinfo: $@ # product/build.prop
@mkdir -p $(dir $@) #
$(hide) rm -f $@ && touch $@
$(hide) $(call generate-common-build-props,product,$@) _prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
$(hide) $(foreach file,$(product_prop_files), \ $(TARGET_PRODUCT_PROP),\
if [ -f "$(file)" ]; then \ $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
echo Target product properties from: "$(file)"; \
echo "" >> $@; \ # Order matters here. When there are duplicates, the last one wins.
echo "#" >> $@; \ # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
echo "# from $(file)" >> $@; \ _prop_vars_ := \
echo "#" >> $@; \ ADDITIONAL_PRODUCT_PROPERTIES \
cat $(file) >> $@; \ PRODUCT_PRODUCT_PROPERTIES
echo "# end of $(file)" >> $@; \
fi;) INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
$(hide) echo "#" >> $@; \ $(eval $(call build-properties,\
echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \ product,\
echo "#" >> $@; \ $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@; $(_prop_files_),\
$(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \ $(_prop_vars_),\
echo "$(line)" >> $@;) $(empty)))
$(hide) $(POST_PROCESS_PROPS) $@
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# odm build.prop # odm/build.prop
INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop #
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET) _prop_files_ := $(if $(TARGET_ODM_PROP),\
$(TARGET_ODM_PROP),\
$(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
ifdef TARGET_ODM_PROP # Order matters here. When there are duplicates, the last one wins.
odm_prop_files := $(TARGET_ODM_PROP) # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
else _prop_vars_ := \
odm_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/odm.prop) ADDITIONAL_ODM_PROPERTIES \
endif PRODUCT_ODM_PROPERTIES
FINAL_ODM_BUILD_PROPERTIES += \ INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
$(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES) $(ADDITIONAL_ODM_PROPERTIES)) $(eval $(call build-properties,\
FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ odm,\
$(FINAL_ODM_BUILD_PROPERTIES),=) $(INSTALLED_ODM_BUILD_PROP_TARGET),\
$(_prop_files),\
$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(odm_prop_files) $(_prop_vars_),\
@echo Target odm buildinfo: $@ $(empty)))
@mkdir -p $(dir $@)
$(hide) rm -f $@ && touch $@
$(hide) $(call generate-common-build-props,odm,$@)
$(hide) $(foreach file,$(odm_prop_files), \
if [ -f "$(file)" ]; then \
echo Target odm properties from: "$(file)"; \
echo "" >> $@; \
echo "#" >> $@; \
echo "# from $(file)" >> $@; \
echo "#" >> $@; \
cat $(file) >> $@; \
echo "# end of $(file)" >> $@; \
fi;)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
$(hide) $(POST_PROCESS_PROPS) $@
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# system_ext build.prop # system_ext/build.prop
#
_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
$(TARGET_SYSTEM_EXT_PROP),\
$(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
# Order matters here. When there are duplicates, the last one wins.
# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) $(eval $(call build-properties,\
system_ext,\
ifdef TARGET_SYSTEM_EXT_PROP $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
system_ext_prop_files := $(TARGET_SYSTEM_EXT_PROP) $(_prop_files_),\
else $(_prop_vars_),\
system_ext_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop) $(empty)))
endif
FINAL_SYSTEM_EXT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_SYSTEM_EXT_PROPERTIES))
FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_SYSTEM_EXT_PROPERTIES),=)
$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(system_ext_prop_files)
@echo Target system_ext buildinfo: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@ && touch $@
$(hide) $(call generate-common-build-props,system_ext,$@)
$(hide) $(foreach file,$(system_ext_prop_files), \
if [ -f "$(file)" ]; then \
echo Target system_ext properties from: "$(file)"; \
echo "" >> $@; \
echo "#" >> $@; \
echo "# from $(file)" >> $@; \
echo "#" >> $@; \
cat $(file) >> $@; \
echo "# end of $(file)" >> $@; \
fi;)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_SYSTEM_EXT_PROPERTIES), \
echo "$(line)" >> $@;)
$(hide) $(POST_PROCESS_PROPS) $@

View File

@ -7,8 +7,9 @@ if [ "$#" -ne 1 ]; then
exit 1 exit 1
fi fi
echo "# begin common build properties" echo "#################################"
echo "# autogenerated by $0" echo "# autogenerated by $0"
echo "#################################"
echo "ro.${partition}.build.date=`$DATE`" echo "ro.${partition}.build.date=`$DATE`"
echo "ro.${partition}.build.date.utc=`$DATE +%s`" echo "ro.${partition}.build.date.utc=`$DATE +%s`"
@ -25,5 +26,3 @@ echo "ro.product.${partition}.device=$PRODUCT_DEVICE"
echo "ro.product.${partition}.manufacturer=$PRODUCT_MANUFACTURER" echo "ro.product.${partition}.manufacturer=$PRODUCT_MANUFACTURER"
echo "ro.product.${partition}.model=$PRODUCT_MODEL" echo "ro.product.${partition}.model=$PRODUCT_MODEL"
echo "ro.product.${partition}.name=$PRODUCT_NAME" echo "ro.product.${partition}.name=$PRODUCT_NAME"
echo "# end common build properties"