diff --git a/core/definitions.mk b/core/definitions.mk index 3512598171..514239bc4b 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2547,14 +2547,31 @@ endef ifeq ($(HOST_OS),linux) # Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat +define extract-package +$(if $(filter aapt2, $(1)), \ + $(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&, \ + $(AAPT) dump badging $@ | awk -F \' '/^package/{print $$2}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&) +endef +define appcompat-header +$(hide) \ + mkdir -p $(PRODUCT_OUT)/appcompat && \ + rm -f $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + echo -n "Package name: " >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + $(call extract-package, $(1)) \ + echo "Module name in Android tree: $(PRIVATE_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + echo "Local path in Android tree: $(PRIVATE_PATH)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + echo >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log +endef define run-appcompat $(hide) \ - mkdir -p $(PRODUCT_OUT)/appcompat; \ - art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 > $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log; + echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log endef else +appcompat-header = run-appcompat = -endif +endif # HOST_OS == linux # Remove dynamic timestamps from packages # diff --git a/core/package_internal.mk b/core/package_internal.mk index 312635fb67..acb128cbab 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -592,10 +592,12 @@ else endif endif -# Run veridex on product modules. +# Run veridex on product, product-services and vendor modules. # We skip it for unbundled app builds where we cannot build veridex. module_run_appcompat := -ifdef LOCAL_PRODUCT_MODULE +ifeq (true,$(filter true, \ + $(LOCAL_PRODUCT_MODULE) $(LOCAL_PRODUCT_SERVICES_MODULE) \ + $(LOCAL_VENDOR_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) # ! unbundled app build module_run_appcompat := true endif @@ -603,6 +605,7 @@ endif ifeq ($(module_run_appcompat),true) $(LOCAL_BUILT_MODULE) : $(call intermediates-dir-for,PACKAGING,veridex,HOST)/veridex.zip +$(LOCAL_BUILT_MODULE): PRIVATE_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) endif $(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) @@ -647,6 +650,11 @@ ifeq (true, $(LOCAL_UNCOMPRESS_DEX)) endif # Run appcompat before stripping the classes.dex file. ifeq ($(module_run_appcompat),true) +ifeq ($(LOCAL_USE_AAPT2),true) + $(call appcompat-header, aapt2) +else + $(appcompat-header) +endif $(run-appcompat) endif # module_run_appcompat ifdef LOCAL_DEX_PREOPT diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 347e729548..a4bf05559b 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -95,10 +95,12 @@ else prebuilt_module_is_dex_javalib := endif -# Run veridex on product modules. +# Run veridex on product, product-services and vendor modules. # We skip it for unbundled app builds where we cannot build veridex. module_run_appcompat := -ifdef LOCAL_PRODUCT_MODULE +ifeq (true,$(filter true, \ + $(LOCAL_PRODUCT_MODULE) $(LOCAL_PRODUCT_SERVICES_MODULE) \ + $(LOCAL_VENDOR_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) # ! unbundled app build module_run_appcompat := true endif @@ -387,6 +389,7 @@ endif ifeq ($(module_run_appcompat),true) $(built_module) : $(call intermediates-dir-for,PACKAGING,veridex,HOST)/veridex.zip +$(LOCAL_BUILT_MODULE): PRIVATE_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) endif $(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR) @@ -405,6 +408,11 @@ ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) @# Only strip out files if we can re-sign the package. # Run appcompat before stripping the classes.dex file. ifeq ($(module_run_appcompat),true) +ifeq ($(LOCAL_USE_AAPT2),true) + $(call appcompat-header, aapt2) +else + $(appcompat-header) +endif $(run-appcompat) endif # module_run_appcompat ifdef LOCAL_DEX_PREOPT