Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd6406c0 authored by Nelson Li's avatar Nelson Li
Browse files

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=<apk path>

Change-Id: I6215f42241f58ba7fc6f4ae5846c4b71d9c1be4f
parent 08445aad
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -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 =