1 # Copyright (C) 2008 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 LOCAL_PATH:= $(call my-dir) 16 include $(CLEAR_VARS) 17 18 # don't include this package in any target 19 LOCAL_MODULE_TAGS := optional 20 # and when built explicitly put it in the data partition 21 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) 22 # and because it is in data, do not strip classes.dex 23 LOCAL_DEX_PREOPT := false 24 25 LOCAL_SRC_FILES := $(call all-java-files-under, src) 26 27 LOCAL_JAVA_LIBRARIES := android.test.runner 28 29 LOCAL_PACKAGE_NAME := SignatureTest 30 31 LOCAL_SDK_VERSION := current 32 33 # To be passed in on command line 34 CTS_API_VERSION ?= current 35 36 ifeq (current,$(CTS_API_VERSION)) 37 android_api_description := frameworks/base/api/$(CTS_API_VERSION).txt 38 else 39 android_api_description := $(SRC_API_DIR)/$(CTS_API_VERSION).txt 40 endif 41 42 # Can't call local-intermediates-dir directly here because we have to 43 # include BUILD_PACAKGE first. Can't include BUILD_PACKAGE first 44 # because we have to override LOCAL_RESOURCE_DIR first. Hence this 45 # hack. 46 intermediates.COMMON := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON) 47 signature_res_dir := $(intermediates.COMMON)/genres 48 LOCAL_RESOURCE_DIR := $(signature_res_dir) $(LOCAL_PATH)/res 49 50 include $(BUILD_PACKAGE) 51 52 generated_res_stamp := $(intermediates.COMMON)/genres.stamp 53 api_ver_file := $(intermediates.COMMON)/api_ver_is_$(CTS_API_VERSION) 54 55 # The api_ver_file keeps track of which api version was last built. 56 # By only ever having one of these magic files in existance and making 57 # sure the generated resources rule depend on it, we can ensure that 58 # the proper version of the api resource gets generated. 59 $(api_ver_file): 60 $(hide) rm -f $(dir $@)/api_ver_is_* \ 61 && mkdir -p $(dir $@) && touch $@ 62 63 android_api_xml_description := $(intermediates.COMMON)/api.xml 64 $(android_api_xml_description): $(android_api_description) | $(APICHECK) 65 @ echo "Convert api file to xml: $@" 66 @ mkdir -p $(dir $@) 67 $(hide) $(APICHECK_COMMAND) -convert2xml $< $@ 68 69 # Split up config/api/1.xml by "package" and save the files as the 70 # resource files of SignatureTest. 71 $(generated_res_stamp): PRIVATE_PATH := $(LOCAL_PATH) 72 $(generated_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE) 73 $(generated_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir) 74 $(generated_res_stamp): PRIVATE_API_XML_DESC := $(android_api_xml_description) 75 $(generated_res_stamp): $(api_ver_file) 76 $(generated_res_stamp): $(android_api_xml_description) 77 @ echo "Copy generated resources: $(PRIVATE_MODULE)" 78 $(hide) python cts/tools/utils/android_api_description_splitter.py \ 79 $(PRIVATE_API_XML_DESC) $(PRIVATE_RES_DIR) package 80 $(hide) touch $@ 81 82 $(R_file_stamp): $(generated_res_stamp) 83 84 # clean up temp vars 85 android_api_xml_description := 86 api_ver_file := 87 generated_res_stamp := 88 signature_res_dir := 89 android_api_description := 90 CTS_API_VERSION := 91 92 93 # Use the folloing include to make our test apk. 94 include $(call all-makefiles-under,$(LOCAL_PATH)) 95