Skip generate-common-build-props for older devices without /product
Common ro.product properties are always generated for the
product partition, even if it is not present. This was introduced
for the R release with Ia88c8efecb18db9c27baa466e492bfd898b581d3
"Generate product build props always" commit.
It violates CDD requirements for the devices which were released
earlier. Add optional parameter to build-properties which allows to
skip the common properies generation and product partition specific
checks to make sure common properties are not generated for
the devices released before R and without product partition.
Test: manual, build product/etc/build.prop for shipping levels 28, 30
and for the devices with and without product partitions
Bug: 174677451
Change-Id: Ia3275d7229d0a873e0a4f1d1ea7a25c758c85bb9
diff --git a/core/sysprop.mk b/core/sysprop.mk
index bb19dc5..1540736 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -71,6 +71,7 @@
# $(3) and (4) are affected
# $(6): optional list of files to append at the end. The content of each file is emitted
# to the output
+# $(7): optional flag to skip common properties generation
define build-properties
ALL_DEFAULT_INSTALLED_MODULES += $(2)
@@ -96,7 +97,9 @@
$(hide) echo Building $$@
$(hide) mkdir -p $$(dir $$@)
$(hide) rm -f $$@ && touch $$@
+ifneq ($(strip $(7)), true)
$(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
+endif
$(hide) $(foreach file,$(strip $(3)),\
if [ -f "$(file)" ]; then\
echo "" >> $$@;\
@@ -309,6 +312,7 @@
$(_prop_files_),\
$(_prop_vars_),\
$(_blacklist_names_),\
+ $(empty),\
$(empty)))
# -----------------------------------------------------------------
@@ -346,6 +350,7 @@
$(_prop_files_),\
$(_prop_vars_),\
$(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
+ $(empty),\
$(empty)))
# -----------------------------------------------------------------
@@ -379,13 +384,28 @@
_footers_ :=
endif
+# Skip common /product properties generation if device released before R and
+# has no product partition. This is the first part of the check.
+ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
+ _skip_common_properties := true
+endif
+
+# The second part of the check - always generate common properties for the
+# devices with product partition regardless of shipping level.
+ifneq ($(BOARD_USES_PRODUCTIMAGE),)
+ _skip_common_properties :=
+endif
+
$(eval $(call build-properties,\
product,\
$(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
$(_prop_files_),\
$(_prop_vars_),\
$(empty),\
- $(_footers_)))
+ $(_footers_),\
+ $(_skip_common_properties)))
+
+_skip_common_properties :=
# ----------------------------------------------------------------
# odm/etc/build.prop
@@ -407,6 +427,7 @@
$(_prop_files),\
$(_prop_vars_),\
$(empty),\
+ $(empty),\
$(empty)))
# ----------------------------------------------------------------
@@ -420,6 +441,7 @@
$(empty),\
$(empty),\
$(empty),\
+ $(empty),\
$(empty)))
# ----------------------------------------------------------------
@@ -433,6 +455,7 @@
$(empty),\
$(empty),\
$(empty),\
+ $(empty),\
$(empty)))
# -----------------------------------------------------------------
@@ -453,6 +476,7 @@
$(_prop_files_),\
$(_prop_vars_),\
$(empty),\
+ $(empty),\
$(empty)))
# ----------------------------------------------------------------
@@ -467,4 +491,5 @@
$(empty),\
$(empty),\
$(empty),\
+ $(empty),\
$(empty)))