blob: 706f6364ef8d0dfa1498ae3292e6af75cda28684 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH:= $(call my-dir)
18
Paul Duffine1446022017-11-07 07:33:11 +000019# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
20ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
21
Paul Duffinbacad402017-06-28 11:57:59 +010022# Generate the stub source files for android.test.runner.stubs
23# ============================================================
24include $(CLEAR_VARS)
25
Paul Duffine2545262017-11-15 11:39:14 +000026LOCAL_SRC_FILES := $(call all-java-files-under, src)
Paul Duffinbacad402017-06-28 11:57:59 +010027
28LOCAL_JAVA_LIBRARIES := \
29 core-oj \
30 core-libart \
31 framework \
Paul Duffin5c993822017-11-16 15:53:09 +000032 android.test.base \
Paul Duffinbacad402017-06-28 11:57:59 +010033 android.test.mock \
34
35LOCAL_MODULE_CLASS := JAVA_LIBRARIES
36LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src
37
38ANDROID_TEST_RUNNER_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/api.txt
39ANDROID_TEST_RUNNER_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/removed.txt
40
41ANDROID_TEST_RUNNER_API_FILE := $(LOCAL_PATH)/api/android-test-runner-current.txt
42ANDROID_TEST_RUNNER_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-runner-removed.txt
43
44LOCAL_DROIDDOC_OPTIONS:= \
45 -stubpackages android.test:android.test.suitebuilder:junit.runner:junit.textui \
46 -stubsourceonly \
47 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.runner.stubs_intermediates/src \
48 -nodocs \
49 -api $(ANDROID_TEST_RUNNER_OUTPUT_API_FILE) \
50 -removedApi $(ANDROID_TEST_RUNNER_OUTPUT_REMOVED_API_FILE) \
51
52LOCAL_UNINSTALLABLE_MODULE := true
53LOCAL_MODULE := android-test-runner-api-stubs-gen
54
55include $(BUILD_DROIDDOC)
56
57# Remember the target that will trigger the code generation.
58android_test_runner_api_gen_stamp := $(full_target)
59
60# Add some additional dependencies
61$(ANDROID_TEST_RUNNER_OUTPUT_API_FILE): $(full_target)
62$(ANDROID_TEST_RUNNER_OUTPUT_REMOVED_API_FILE): $(full_target)
63
64# Build the android.test.runner.stubs library
65# ===========================================
66include $(CLEAR_VARS)
67
68LOCAL_MODULE := android.test.runner.stubs
69
70LOCAL_JAVA_LIBRARIES := \
Paul Duffin5c993822017-11-16 15:53:09 +000071 android.test.base.stubs \
Paul Duffinbacad402017-06-28 11:57:59 +010072 android.test.mock.stubs \
73
74LOCAL_SOURCE_FILES_ALL_GENERATED := true
Paul Duffind41d8472017-06-30 16:02:09 +010075LOCAL_SDK_VERSION := current
Paul Duffinbacad402017-06-28 11:57:59 +010076
Paul Duffinbacad402017-06-28 11:57:59 +010077# Make sure to run droiddoc first to generate the stub source files.
Colin Cross85ab4062017-09-05 22:59:27 -070078LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_runner_api_gen_stamp)
Paul Duffind41d8472017-06-30 16:02:09 +010079android_test_runner_api_gen_stamp :=
Colin Cross85ab4062017-09-05 22:59:27 -070080
81include $(BUILD_STATIC_JAVA_LIBRARY)
Paul Duffinbacad402017-06-28 11:57:59 +010082
83# Archive a copy of the classes.jar in SDK build.
84$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.runner.stubs.jar)
85
86# Check that the android.test.runner.stubs library has not changed
87# ================================================================
88
89# Check that the API we're building hasn't changed from the not-yet-released
90# SDK version.
91$(eval $(call check-api, \
92 check-android-test-runner-api-current, \
93 $(ANDROID_TEST_RUNNER_API_FILE), \
94 $(ANDROID_TEST_RUNNER_OUTPUT_API_FILE), \
95 $(ANDROID_TEST_RUNNER_REMOVED_API_FILE), \
96 $(ANDROID_TEST_RUNNER_OUTPUT_REMOVED_API_FILE), \
97 -error 2 -error 3 -error 4 -error 5 -error 6 \
98 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
99 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
100 -error 25 -error 26 -error 27, \
101 cat $(LOCAL_PATH)/api/apicheck_msg_android_test_runner.txt, \
102 check-android-test-runner-api, \
103 $(call doc-timestamp-for,android-test-runner-api-stubs-gen) \
104 ))
105
106.PHONY: check-android-test-runner-api
107checkapi: check-android-test-runner-api
108
109.PHONY: update-android-test-runner-api
110update-api: update-android-test-runner-api
111
112update-android-test-runner-api: $(ANDROID_TEST_RUNNER_OUTPUT_API_FILE) | $(ACP)
113 @echo Copying current.txt
114 $(hide) $(ACP) $(ANDROID_TEST_RUNNER_OUTPUT_API_FILE) $(ANDROID_TEST_RUNNER_API_FILE)
115 @echo Copying removed.txt
116 $(hide) $(ACP) $(ANDROID_TEST_RUNNER_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_RUNNER_REMOVED_API_FILE)
117
Paul Duffine1446022017-11-07 07:33:11 +0000118endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true
Paul Duffin006b7a22017-12-11 15:13:08 +0000119
120# additionally, build unit tests in a separate .apk
121include $(call all-makefiles-under,$(LOCAL_PATH))