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