From fd6406c066e5de2c6f0976fe120d76aafdb0c86e Mon Sep 17 00:00:00 2001 From: Nelson Li Date: Wed, 29 May 2024 06:31:35 +0000 Subject: [PATCH] Convert appcompat.sh to a Python binary Previously, to use `appcompat.sh`, we hardcoded absolute paths for many dependencies in the `build/core/definitions.mk` file, and the same was done in `art/tools/veridex/Android.mk`. This change converts `appcompat.sh` to `appcompat.py` and packages the necessary files into a `Python binary`. This not only resolves the issue of hardcoding absolute dependency paths but also allows users to use the tool directly without having to specify dependency paths, making it more convenient. Bug: 343105310 Test: 1. m appcompat 2. m CarrierConfig (any module with appcompat) 3. appcompat --dex-file= Change-Id: I6215f42241f58ba7fc6f4ae5846c4b71d9c1be4f --- core/definitions.mk | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index eabcc68499..9f911e6bdf 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2925,19 +2925,15 @@ $(hide) \ echo "Install path: $(patsubst $(PRODUCT_OUT)/%,%,$(PRIVATE_INSTALLED_MODULE))" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ echo >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log endef -ART_VERIDEX_APPCOMPAT_SCRIPT:=$(HOST_OUT)/bin/appcompat.sh +ART_VERIDEX_APPCOMPAT:=$(HOST_OUT)/bin/appcompat define run-appcompat $(hide) \ - echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ - PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING ANDROID_LOG_TAGS="*:e" $(ART_VERIDEX_APPCOMPAT_SCRIPT) --dex-file=$@ --api-flags=$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log + echo "appcompat output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ + ANDROID_LOG_TAGS="*:e" $(ART_VERIDEX_APPCOMPAT) --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log endef appcompat-files = \ $(AAPT2) \ - $(ART_VERIDEX_APPCOMPAT_SCRIPT) \ - $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \ - $(HOST_OUT_EXECUTABLES)/veridex \ - $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex \ - $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex + $(ART_VERIDEX_APPCOMPAT) \ else appcompat-header = run-appcompat =