blob: cc0d53ccfcbbb9924f178ea763b59a76d97cc680 [file] [log] [blame]
The Android Open Source Projectf8057102009-03-15 16:47:16 -07001# 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
15LOCAL_PATH:= $(call my-dir)
16include $(CLEAR_VARS)
17
Brett Chabot5a546332009-08-28 12:22:23 -070018# don't include this package in any target
Brett Chabotf9e03e12009-08-13 20:55:28 -070019LOCAL_MODULE_TAGS := optional
Brett Chabot5a546332009-08-28 12:22:23 -070020# and when built explicitly put it in the data partition
21LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
Brian Carlstromcb711272012-06-16 23:32:47 -070022# and because it is in data, do not strip classes.dex
23LOCAL_DEX_PREOPT := false
The Android Open Source Projectf8057102009-03-15 16:47:16 -070024
Brett Chabot584d2b92011-02-03 17:56:49 -080025LOCAL_SRC_FILES := $(call all-java-files-under, src)
The Android Open Source Projectf8057102009-03-15 16:47:16 -070026
27LOCAL_JAVA_LIBRARIES := android.test.runner
28
29LOCAL_PACKAGE_NAME := SignatureTest
30
Bill Napier31f8d502009-05-14 18:07:17 -070031LOCAL_SDK_VERSION := current
32
The Android Open Source Projectf8057102009-03-15 16:47:16 -070033# To be passed in on command line
34CTS_API_VERSION ?= current
35
Joe Onoratofd4394e2011-04-08 16:05:12 -070036android_api_description := $(SRC_API_DIR)/$(CTS_API_VERSION).txt
The Android Open Source Projectf8057102009-03-15 16:47:16 -070037
38# Can't call local-intermediates-dir directly here because we have to
39# include BUILD_PACAKGE first. Can't include BUILD_PACKAGE first
40# because we have to override LOCAL_RESOURCE_DIR first. Hence this
41# hack.
42intermediates.COMMON := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
43signature_res_dir := $(intermediates.COMMON)/genres
44LOCAL_RESOURCE_DIR := $(signature_res_dir)
45
46# These shell commands allow us to get around the package.mk check for
47# empty/non-existent resouce dirs (which ours would be). If it finds
48# an empty/non-existent resource dir, R_file_stamp doesn't contain a
49# target and our stuff never gets copied.
50# TODO: fix package.mk so we can avoid this hack
51fake_resource_check := $(signature_res_dir)/raw/fake_resource_check
52
53$(shell \
54 if [ ! -f $(fake_resource_check) ]; then \
55 mkdir -p $(dir $(fake_resource_check)); \
56 touch $(fake_resource_check); \
57 fi \
58 )
59
60include $(BUILD_PACKAGE)
61
62copied_res_stamp := $(intermediates.COMMON)/copyres.stamp
63generated_res_stamp := $(intermediates.COMMON)/genres.stamp
64api_ver_path := $(intermediates.COMMON)
65api_ver_file := $(api_ver_path)/api_ver_is_$(CTS_API_VERSION)
66
67# The api_ver_file keeps track of which api version was last built.
68# By only ever having one of these magic files in existance and making
69# sure the generated resources rule depend on it, we can ensure that
70# the proper version of the api resource gets generated.
71$(api_ver_file):
Joe Onoratofd4394e2011-04-08 16:05:12 -070072 $(hide) rm -f $(api_ver_path)/api_ver_is_*
The Android Open Source Projectf8057102009-03-15 16:47:16 -070073 $(hide) touch $@
74
Joe Onoratofd4394e2011-04-08 16:05:12 -070075android_api_xml_description := $(intermediates.COMMON)/api.xml
76$(android_api_xml_description): PRIVATE_INPUT_FILE := $(android_api_description)
77$(android_api_xml_description): $(android_api_description) $(APICHECK)
78 $(hide) echo "Convert api file to xml: $@"
79 $(hide) $(APICHECK_COMMAND) -convert2xml $(PRIVATE_INPUT_FILE) $@
80
The Android Open Source Projectf8057102009-03-15 16:47:16 -070081static_res_deps := $(call find-subdir-assets,$(LOCAL_PATH)/res)
82$(copied_res_stamp): PRIVATE_PATH := $(LOCAL_PATH)
83$(copied_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
84$(copied_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir)
Jean-Baptiste Querude6bc372009-12-21 13:54:18 -080085$(copied_res_stamp): FAKE_RESOURCE_DIR := $(dir $(fake_resource_check))
86$(copied_res_stamp): FAKE_RESOURCE_CHECK := $(fake_resource_check)
The Android Open Source Projectf8057102009-03-15 16:47:16 -070087$(copied_res_stamp): $(foreach res,$(static_res_deps),$(LOCAL_PATH)/res/${res}) | $(ACP)
Joe Onoratofd4394e2011-04-08 16:05:12 -070088 $(hide) echo "Copy resources: $(PRIVATE_MODULE)"
89 $(hide) rm -f $@
90 $(hide) rm -rf $(PRIVATE_RES_DIR)
91 $(hide) mkdir -p $(PRIVATE_RES_DIR)
92 $(hide) if [ ! -f $(FAKE_RESOURCE_CHECK) ]; \
Jean-Baptiste Querude6bc372009-12-21 13:54:18 -080093 then mkdir -p $(FAKE_RESOURCE_DIR); \
94 touch $(FAKE_RESOURCE_CHECK); \
95 fi
The Android Open Source Projectf8057102009-03-15 16:47:16 -070096 $(hide) $(ACP) -rd $(PRIVATE_PATH)/res/* $(PRIVATE_RES_DIR)/
97 $(hide) touch $@
98
99# Split up config/api/1.xml by "package" and save the files as the
100# resource files of SignatureTest.
101$(generated_res_stamp): PRIVATE_PATH := $(LOCAL_PATH)
102$(generated_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
103$(generated_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir)
104$(generated_res_stamp): $(api_ver_file)
Joe Onoratofd4394e2011-04-08 16:05:12 -0700105$(generated_res_stamp): $(copied_res_stamp) $(android_api_xml_description)
106 $(hide) echo "Copy generated resources: $(PRIVATE_MODULE)"
107 $(hide) rm -f $@
The Android Open Source Projectf8057102009-03-15 16:47:16 -0700108 $(hide) python cts/tools/utils/android_api_description_splitter.py \
Joe Onoratofd4394e2011-04-08 16:05:12 -0700109 $(android_api_xml_description) $(PRIVATE_RES_DIR) package
The Android Open Source Projectf8057102009-03-15 16:47:16 -0700110 $(hide) touch $@
111
112$(R_file_stamp): $(generated_res_stamp) $(copied_res_stamp)
Bill Napierfbcc0a62009-04-06 10:33:01 -0700113
114# Use the folloing include to make our test apk.
115include $(call all-makefiles-under,$(LOCAL_PATH))