blob: 26fd6dc403be26e12e4ebea6a9d9190313a4988d [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
18LOCAL_MODULE_TAGS := tests
19
20LOCAL_SRC_FILES := $(call all-subdir-java-files)
21
22LOCAL_JAVA_LIBRARIES := android.test.runner
23
24LOCAL_PACKAGE_NAME := SignatureTest
25
26# To be passed in on command line
27CTS_API_VERSION ?= current
28
29android_api_description := $(SRC_API_DIR)/$(CTS_API_VERSION).xml
30
31# Can't call local-intermediates-dir directly here because we have to
32# include BUILD_PACAKGE first. Can't include BUILD_PACKAGE first
33# because we have to override LOCAL_RESOURCE_DIR first. Hence this
34# hack.
35intermediates.COMMON := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
36signature_res_dir := $(intermediates.COMMON)/genres
37LOCAL_RESOURCE_DIR := $(signature_res_dir)
38
39# These shell commands allow us to get around the package.mk check for
40# empty/non-existent resouce dirs (which ours would be). If it finds
41# an empty/non-existent resource dir, R_file_stamp doesn't contain a
42# target and our stuff never gets copied.
43# TODO: fix package.mk so we can avoid this hack
44fake_resource_check := $(signature_res_dir)/raw/fake_resource_check
45
46$(shell \
47 if [ ! -f $(fake_resource_check) ]; then \
48 mkdir -p $(dir $(fake_resource_check)); \
49 touch $(fake_resource_check); \
50 fi \
51 )
52
53include $(BUILD_PACKAGE)
54
55copied_res_stamp := $(intermediates.COMMON)/copyres.stamp
56generated_res_stamp := $(intermediates.COMMON)/genres.stamp
57api_ver_path := $(intermediates.COMMON)
58api_ver_file := $(api_ver_path)/api_ver_is_$(CTS_API_VERSION)
59
60# The api_ver_file keeps track of which api version was last built.
61# By only ever having one of these magic files in existance and making
62# sure the generated resources rule depend on it, we can ensure that
63# the proper version of the api resource gets generated.
64$(api_ver_file):
65 @rm -f $(api_ver_path)/api_ver_is_*
66 $(hide) touch $@
67
68static_res_deps := $(call find-subdir-assets,$(LOCAL_PATH)/res)
69$(copied_res_stamp): PRIVATE_PATH := $(LOCAL_PATH)
70$(copied_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
71$(copied_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir)
72$(copied_res_stamp): $(foreach res,$(static_res_deps),$(LOCAL_PATH)/res/${res}) | $(ACP)
73 @echo "Copy resources: $(PRIVATE_MODULE)"
74 @rm -f $@
75 @rm -rf $(PRIVATE_RES_DIR)
76 @mkdir -p $(PRIVATE_RES_DIR)
77 $(hide) $(ACP) -rd $(PRIVATE_PATH)/res/* $(PRIVATE_RES_DIR)/
78 $(hide) touch $@
79
80# Split up config/api/1.xml by "package" and save the files as the
81# resource files of SignatureTest.
82$(generated_res_stamp): PRIVATE_PATH := $(LOCAL_PATH)
83$(generated_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
84$(generated_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir)
85$(generated_res_stamp): $(api_ver_file)
86$(generated_res_stamp): $(copied_res_stamp) $(android_api_description)
87 @echo "Copy generated resources: $(PRIVATE_MODULE)"
88 @rm -f $@
89 $(hide) python cts/tools/utils/android_api_description_splitter.py \
90 $(android_api_description) $(PRIVATE_RES_DIR) package
91 $(hide) touch $@
92
93$(R_file_stamp): $(generated_res_stamp) $(copied_res_stamp)
Bill Napierfbcc0a62009-04-06 10:33:01 -070094
95# Use the folloing include to make our test apk.
96include $(call all-makefiles-under,$(LOCAL_PATH))