1# 2# Copyright (C) 2018 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# TODO(b/172480617): Clean up the platform dependencies on this. 18 19LOCAL_PATH := $(call my-dir) 20 21# The veridex tool takes stub dex files as input, so we generate both the system and oahl 22# dex stubs. 23 24system_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex 25$(system_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 26$(system_stub_dex): $(call resolve-prebuilt-sdk-jar-path,system_current) | $(ZIP2ZIP) $(DX) 27 $(transform-classes.jar-to-dex) 28 29 30oahl_stub_dex := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex 31$(oahl_stub_dex): PRIVATE_MIN_SDK_VERSION := 1000 32$(oahl_stub_dex): $(call get-prebuilt-sdk-dir,current)/org.apache.http.legacy.jar | $(ZIP2ZIP) $(DX) 33 $(transform-classes.jar-to-dex) 34 35# Phony rule to create all dependencies of the appcompat.sh script. 36.PHONY: appcompat 37appcompat: $(system_stub_dex) $(oahl_stub_dex) $(HOST_OUT_EXECUTABLES)/veridex \ 38 $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) 39 40VERIDEX_FILES_PATH := \ 41 $(call intermediates-dir-for,PACKAGING,veridex,HOST)/veridex.zip 42 43VERIDEX_FILES := $(LOCAL_PATH)/appcompat.sh 44 45$(VERIDEX_FILES_PATH): PRIVATE_VERIDEX_FILES := $(VERIDEX_FILES) 46$(VERIDEX_FILES_PATH): PRIVATE_SYSTEM_STUBS_DEX_DIR := $(dir $(system_stub_dex)) 47$(VERIDEX_FILES_PATH): PRIVATE_SYSTEM_STUBS_ZIP := $(dir $(VERIDEX_FILES_PATH))/system-stubs.zip 48$(VERIDEX_FILES_PATH): PRIVATE_OAHL_STUBS_DEX_DIR := $(dir $(oahl_stub_dex)) 49$(VERIDEX_FILES_PATH): PRIVATE_OAHL_STUBS_ZIP := $(dir $(VERIDEX_FILES_PATH))/org.apache.http.legacy-stubs.zip 50$(VERIDEX_FILES_PATH) : $(SOONG_ZIP) $(VERIDEX_FILES) $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \ 51 $(HOST_OUT_EXECUTABLES)/veridex $(system_stub_dex) $(oahl_stub_dex) 52 rm -rf $(dir $@)/* 53 ls -1 $(PRIVATE_SYSTEM_STUBS_DEX_DIR)/classes*.dex | sort >$(PRIVATE_SYSTEM_STUBS_ZIP).list 54 $(SOONG_ZIP) -o $(PRIVATE_SYSTEM_STUBS_ZIP) -C $(PRIVATE_SYSTEM_STUBS_DEX_DIR) -l $(PRIVATE_SYSTEM_STUBS_ZIP).list 55 rm $(PRIVATE_SYSTEM_STUBS_ZIP).list 56 ls -1 $(PRIVATE_OAHL_STUBS_DEX_DIR)/classes*.dex | sort >$(PRIVATE_OAHL_STUBS_ZIP).list 57 $(SOONG_ZIP) -o $(PRIVATE_OAHL_STUBS_ZIP) -C $(PRIVATE_OAHL_STUBS_DEX_DIR) -l $(PRIVATE_OAHL_STUBS_ZIP).list 58 rm $(PRIVATE_OAHL_STUBS_ZIP).list 59 $(SOONG_ZIP) -o $@ -C art/tools/veridex -f $(PRIVATE_VERIDEX_FILES) \ 60 -C $(dir $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS)) \ 61 -f $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \ 62 -C $(HOST_OUT_EXECUTABLES) -f $(HOST_OUT_EXECUTABLES)/veridex \ 63 -C $(dir $(PRIVATE_SYSTEM_STUBS_ZIP)) -f $(PRIVATE_SYSTEM_STUBS_ZIP) \ 64 -C $(dir $(PRIVATE_OAHL_STUBS_ZIP)) -f $(PRIVATE_OAHL_STUBS_ZIP) 65 rm -f $(PRIVATE_SYSTEM_STUBS_ZIP) 66 rm -f $(PRIVATE_OAHL_STUBS_ZIP) 67 68# Make the zip file available for prebuilts. 69$(call dist-for-goals,sdk,$(VERIDEX_FILES_PATH)) 70 71VERIDEX_FILES := 72system_stub_dex := 73oahl_stub_dex := 74