Add support for TARGET_PRODUCT_PROP
Like TARGET_SYSTEM_PROP, but is merged into /product/build.prop.
Also change the formatting of the output of both of these macros
slightly, so make the start and end clearer.
Bug: 119911662
Test: migrate downstream products to use this
Change-Id: Iddae7aac3c51b5706f3fb2690c5ca5a98840ad34
diff --git a/core/Makefile b/core/Makefile
index 8bfe960..587eaf8 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -415,11 +415,13 @@
bash $(BUILDINFO_SH) >> $@
$(hide) $(foreach file,$(system_prop_file), \
if [ -f "$(file)" ]; then \
- echo "#" >> $@; \
echo Target buildinfo from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
echo "# from $(file)" >> $@; \
echo "#" >> $@; \
cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
fi;)
$(if $(FINAL_BUILD_PROPERTIES), \
$(hide) echo >> $@; \
@@ -486,22 +488,38 @@
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
+product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
+endif
+
FINAL_PRODUCT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_PROPERTIES),=)
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
@echo Target product buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
ifdef BOARD_USES_PRODUCTIMAGE
$(hide) $(call generate-common-build-props,product,$@)
endif # BOARD_USES_PRODUCTIMAGE
+ $(hide) $(foreach file,$(product_prop_files), \
+ if [ -f "$(file)" ]; then \
+ echo Target product properties from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
+ echo "# from $(file)" >> $@; \
+ echo "#" >> $@; \
+ cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
+ fi;)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
echo "#" >> $@; \
- echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
+ echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
$(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@