Build the proguard dict zip without PACKAGING intermediates
Before, as each module was built, it would dump its proguard-related
files into the PACKAGING folder. Then the rule for the final distable
zip would zip up this whole folder. This means that if you built a
module that was not part of the system, and then rebuilt the final
zip, it would erronously include more proguard files than necessary.
This problem was worked around by relying on CI to run `m installclean`
every time.
Now, the zip proguard files always include the same information.
This also makes it so that when you build a module, its proguard files
are not copied to the PACKAGING folder, making builds that don't
build the final proguard zips slightly faster.
Bug: 205632228
Test: diff'd proguard-dict.zip, proguard-dict-mapping.textproto, and proguard-usage.zip before/after this cl on sdk_phone_x86_64. They have diffs, but only in the order of files / lines.
Change-Id: I98c02e1eb117c337ba9b98f04ad486597eb9bb86
diff --git a/core/main.mk b/core/main.mk
index 12b7bd0..72dd6db 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1232,9 +1232,7 @@
endef
-# Lists most of the files a particular product installs, including:
-# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
-# - PRODUCT_COPY_FILES
+# Lists the modules particular product installs.
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
# by product_config.mk.
@@ -1246,8 +1244,7 @@
# Name resolution for LOCAL_REQUIRED_MODULES:
# See the select-bitness-of-required-modules definition.
# $(1): product makefile
-
-define product-installed-files
+define product-installed-modules
$(eval _pif_modules := \
$(call get-product-var,$(1),PRODUCT_PACKAGES) \
$(if $(filter eng,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_ENG)) \
@@ -1264,7 +1261,14 @@
$(eval ### Resolve the :32 :64 module name) \
$(eval _pif_modules := $(sort $(call resolve-bitness-for-modules,TARGET,$(_pif_modules)))) \
$(call expand-required-modules,_pif_modules,$(_pif_modules),$(_pif_overrides)) \
- $(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(_pif_modules))) \
+ $(_pif_modules)
+endef
+
+# Lists most of the files a particular product installs.
+# It gives all the installed files for all modules returned by product-installed-modules,
+# and also includes PRODUCT_COPY_FILES.
+define product-installed-files
+ $(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(call product-installed-modules,$(1)))) \
$(call resolve-product-relative-paths,\
$(foreach cf,$(call get-product-var,$(1),PRODUCT_COPY_FILES),$(call word-colon,2,$(cf))))
endef
@@ -1437,6 +1441,16 @@
$(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!)))
endif
+ifneq ($(TARGET_BUILD_APPS),)
+ # If this build is just for apps, only build apps and not the full system by default.
+ ifneq ($(filter all,$(TARGET_BUILD_APPS)),)
+ # If they used the magic goal "all" then build all apps in the source tree.
+ unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m)))
+ else
+ unbundled_build_modules := $(sort $(TARGET_BUILD_APPS))
+ endif
+endif
+
# build/make/core/Makefile contains extra stuff that we don't want to pollute this
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further
@@ -1712,14 +1726,6 @@
else ifneq ($(TARGET_BUILD_APPS),)
# If this build is just for apps, only build apps and not the full system by default.
- unbundled_build_modules :=
- ifneq ($(filter all,$(TARGET_BUILD_APPS)),)
- # If they used the magic goal "all" then build all apps in the source tree.
- unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m)))
- else
- unbundled_build_modules := $(sort $(TARGET_BUILD_APPS))
- endif
-
# Dist the installed files if they exist, except the installed symlinks. dist-for-goals emits
# `cp src dest` commands, which will fail to copy dangling symlinks.
apps_only_installed_files := $(foreach m,$(unbundled_build_modules),\