diff options
| author | 2018-05-23 11:22:30 +0100 | |
|---|---|---|
| committer | 2018-05-30 13:04:17 +0100 | |
| commit | 8fb6784a56a9df03d115ef47c62ca55b433d00cc (patch) | |
| tree | 486286e3c00f6cc6dcf048fb7db4e7058ac43b7d | |
| parent | b7e784694ba9c2399492d69710bede711a3b552d (diff) | |
Add sdk destinations for appcompat.sh related files.
bug: 79936439
Test: m
Change-Id: I9a41a8f2c5b0bd253e38f955204dc3f91956cc28
| -rw-r--r-- | tools/veridex/Android.bp | 7 | ||||
| -rw-r--r-- | tools/veridex/Android.mk | 31 | ||||
| -rwxr-xr-x | tools/veridex/appcompat.sh | 27 |
3 files changed, 55 insertions, 10 deletions
diff --git a/tools/veridex/Android.bp b/tools/veridex/Android.bp index 5186c43ca2..96d4a094b5 100644 --- a/tools/veridex/Android.bp +++ b/tools/veridex/Android.bp @@ -24,11 +24,16 @@ cc_binary { "veridex.cc", ], cflags: ["-Wall", "-Werror"], - shared_libs: [ + static_libs: [ "libdexfile", "libartbase", "libbase", + "liblog", + "libutils", + "libz", + "libziparchive", ], + stl: "libc++_static", header_libs: [ "art_libartbase_headers", ], diff --git a/tools/veridex/Android.mk b/tools/veridex/Android.mk index 51d924a3c1..83fa0d6397 100644 --- a/tools/veridex/Android.mk +++ b/tools/veridex/Android.mk @@ -16,6 +16,9 @@ LOCAL_PATH := $(call my-dir) +# The veridex tool takes stub dex files as input, so we generate both the system and oahl +# dex stubs. + system_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex $(system_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 $(system_stub_dex): $(call resolve-prebuilt-sdk-jar-path,system_current) | $(ZIP2ZIP) $(DX) @@ -27,9 +30,29 @@ $(oahl_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 $(oahl_stub_dex): $(call get-prebuilt-sdk-dir,current)/org.apache.http.legacy.jar | $(ZIP2ZIP) $(DX) $(transform-classes-d8.jar-to-dex) +app_compat_lists := \ + $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \ + $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \ + $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) + +# Phony rule to create all dependencies of the appcompat.sh script. .PHONY: appcompat +appcompat: $(system_stub_dex) $(oahl_stub_dex) $(HOST_OUT_EXECUTABLES)/veridex $(app_compat_lists) + +VERIDEX_FILES_PATH := \ + $(call intermediates-dir-for,PACKAGING,veridex,HOST)/veridex.zip + +VERIDEX_FILES := $(LOCAL_PATH)/appcompat.sh + +$(VERIDEX_FILES_PATH): PRIVATE_VERIDEX_FILES := $(VERIDEX_FILES) +$(VERIDEX_FILES_PATH): PRIVATE_APP_COMPAT_LISTS := $(app_compat_lists) +$(VERIDEX_FILES_PATH) : $(SOONG_ZIP) $(VERIDEX_FILES) $(app_compat_lists) $(HOST_OUT_EXECUTABLES)/veridex + $(hide) $(SOONG_ZIP) -o $@ -C art/tools/veridex -f $(PRIVATE_VERIDEX_FILES) \ + -C $(dir $(lastword $(PRIVATE_APP_COMPAT_LISTS))) $(addprefix -f , $(PRIVATE_APP_COMPAT_LISTS)) \ + -C $(HOST_OUT_EXECUTABLES) -f $(HOST_OUT_EXECUTABLES)/veridex + +# Make the zip file available for prebuilts. +$(call dist-for-goals,sdk,$(VERIDEX_FILES_PATH)) -appcompat: $(system_stub_dex) $(oahl_stub_dex) $(HOST_OUT_EXECUTABLES)/veridex \ - ${TARGET_OUT_COMMON_INTERMEDIATES}/PACKAGING/hiddenapi-light-greylist.txt \ - ${TARGET_OUT_COMMON_INTERMEDIATES}/PACKAGING/hiddenapi-dark-greylist.txt \ - ${TARGET_OUT_COMMON_INTERMEDIATES}/PACKAGING/hiddenapi-blacklist.txt +VERIDEX_FILES := +app_compat_lists := diff --git a/tools/veridex/appcompat.sh b/tools/veridex/appcompat.sh index 31a8654b58..c07ab21a4b 100755 --- a/tools/veridex/appcompat.sh +++ b/tools/veridex/appcompat.sh @@ -14,7 +14,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -# We want to be at the root for simplifying the "out" detection +echo "NOTE: appcompat.sh is still under development. It can report" +echo "API uses that do not execute at runtime, and reflection uses" +echo "that do not exist. It can also miss on reflection uses." + +# First check if the script is invoked from a prebuilts location. +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +if [[ -e ${SCRIPT_DIR}/veridex && \ + -e ${SCRIPT_DIR}/hiddenapi-blacklist.txt && \ + -e ${SCRIPT_DIR}/hiddenapi-light-greylist.txt && \ + -e ${SCRIPT_DIR}/hiddenapi-dark-greylist.txt && \ + -e ${SCRIPT_DIR}/org.apache.http.legacy-stubs.dex && \ + -e ${SCRIPT_DIR}/system-stubs.dex ]]; then + exec ${SCRIPT_DIR}/veridex \ + --core-stubs=${SCRIPT_DIR}/system-stubs.dex:${SCRIPT_DIR}/org.apache.http.legacy-stubs.dex \ + --blacklist=${SCRIPT_DIR}/hiddenapi-blacklist.txt \ + --light-greylist=${SCRIPT_DIR}/hiddenapi-light-greylist.txt \ + --dark-greylist=${SCRIPT_DIR}/hiddenapi-dark-greylist.txt \ + $@ +fi + +# Otherwise, we want to be at the root for simplifying the "out" detection # logic. if [ ! -d art ]; then echo "Script needs to be run at the root of the android tree." @@ -38,10 +59,6 @@ if [ -z "$ANDROID_HOST_OUT" ] ; then ANDROID_HOST_OUT=${OUT}/host/linux-x86 fi -echo "NOTE: appcompat.sh is still under development. It can report" -echo "API uses that do not execute at runtime, and reflection uses" -echo "that do not exist. It can also miss on reflection uses." - ${ANDROID_HOST_OUT}/bin/veridex \ --core-stubs=${PACKAGING}/core_dex_intermediates/classes.dex:${PACKAGING}/oahl_dex_intermediates/classes.dex \ |