blob: 209e78af5bb1340e868d9210cff517022c36a018 [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
Stuart Scottc09a2e02013-11-15 13:03:29 -080020
Brett Chabot584d2b92011-02-03 17:56:49 -080021LOCAL_SRC_FILES := $(call all-java-files-under, src)
The Android Open Source Projectf8057102009-03-15 16:47:16 -070022
23LOCAL_JAVA_LIBRARIES := android.test.runner
24
25LOCAL_PACKAGE_NAME := SignatureTest
26
Bill Napier31f8d502009-05-14 18:07:17 -070027LOCAL_SDK_VERSION := current
28
Stuart Scott2e1ce772013-11-15 14:26:40 -080029# To be passed in on command line
30CTS_API_VERSION ?= current
31ifeq (current,$(CTS_API_VERSION))
32android_api_description := frameworks/base/api/$(CTS_API_VERSION).txt
33else
34android_api_description := $(SRC_API_DIR)/$(CTS_API_VERSION).txt
35endif
36
37# Can't call local-intermediates-dir directly here because we have to
38# include BUILD_CTS_PACKAGE first. Can't include BUILD_CTS_PACKAGE first
39# because we have to override LOCAL_RESOURCE_DIR first. Hence this
40# hack.
41intermediates.COMMON := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
42signature_res_dir := $(intermediates.COMMON)/genres
43LOCAL_RESOURCE_DIR := $(signature_res_dir) $(LOCAL_PATH)/res
44
Stuart Scottc09a2e02013-11-15 13:03:29 -080045include $(BUILD_CTS_PACKAGE)
The Android Open Source Projectf8057102009-03-15 16:47:16 -070046
Stuart Scott2e1ce772013-11-15 14:26:40 -080047$(info $(call local-intermediates-dir))
48
49generated_res_stamp := $(intermediates.COMMON)/genres.stamp
50api_ver_file := $(intermediates.COMMON)/api_ver_is_$(CTS_API_VERSION)
51
52# The api_ver_file keeps track of which api version was last built.
53# By only ever having one of these magic files in existence and making
54# sure the generated resources rule depend on it, we can ensure that
55# the proper version of the api resource gets generated.
56$(api_ver_file):
57 $(hide) rm -f $(dir $@)/api_ver_is_* \
58 && mkdir -p $(dir $@) && touch $@
59
60android_api_xml_description := $(intermediates.COMMON)/api.xml
61$(android_api_xml_description): $(android_api_description) | $(APICHECK)
62 @ echo "Convert api file to xml: $@"
63 @ mkdir -p $(dir $@)
64 $(hide) $(APICHECK_COMMAND) -convert2xml $< $@
65
66# Split up config/api/1.xml by "package" and save the files as the
67# resource files of SignatureTest.
68$(generated_res_stamp): PRIVATE_PATH := $(LOCAL_PATH)
69$(generated_res_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
70$(generated_res_stamp): PRIVATE_RES_DIR := $(signature_res_dir)
71$(generated_res_stamp): PRIVATE_API_XML_DESC := $(android_api_xml_description)
72$(generated_res_stamp): $(api_ver_file)
73$(generated_res_stamp): $(android_api_xml_description)
74 @ echo "Copy generated resources: $(PRIVATE_MODULE)"
75 $(hide) python cts/tools/utils/android_api_description_splitter.py \
76 $(PRIVATE_API_XML_DESC) $(PRIVATE_RES_DIR) package
77 $(hide) touch $@
78
79$(R_file_stamp): $(generated_res_stamp)
80
81# clean up temp vars
82android_api_xml_description :=
83api_ver_file :=
84generated_res_stamp :=
85signature_res_dir :=
86android_api_description :=
87CTS_API_VERSION :=
88
Stuart Scottc09a2e02013-11-15 13:03:29 -080089# Use the following include to make our test apk.
Bill Napierfbcc0a62009-04-06 10:33:01 -070090include $(call all-makefiles-under,$(LOCAL_PATH))