Enforce RROs for all the build-time ROs
This CL is to generate every static RRO package for its target package
automatically at build-time.
BOARD_ENFORCE_RRO build variable is added to specify whether enforcing
RRO is required or not.
BOARD_ENFORCE_RRO_EXEMPT_SOURCES build variable is added to specify
the module list of which item should be exempt from enforcing RRO.
Test: tested on bullhead and sailfish
Bug: 34097942
Change-Id: I455b2ce34e66c57a540c299b5e378b7c4e78d5b8
(cherry picked from commit 3070610b729e695668a9d93e546907903956a74d)
diff --git a/core/main.mk b/core/main.mk
index 41d903b..8200a4c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -497,6 +497,10 @@
ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES))
.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
+ifeq ($(BOARD_ENFORCE_RRO),true)
+ENFORCE_RRO_SOURCES :=
+endif
+
ifneq ($(ONE_SHOT_MAKEFILE),)
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.
@@ -563,6 +567,13 @@
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
+# -------------------------------------------------------------------
+# Enforce to generate all RRO packages for modules having resource
+# overlays.
+# -------------------------------------------------------------------
+ifeq ($(BOARD_ENFORCE_RRO),true)
+$(call generate_all_enforce_rro_packages)
+endif
# -------------------------------------------------------------------
# Fix up CUSTOM_MODULES to refer to installed files rather than