blob: 7926a77ccb01d2cb0f342a0527cdf5624a2db74e [file] [log] [blame]
Paul Duffine2545262017-11-15 11:39:14 +00001#
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 Duffinbd97e3d2017-12-19 15:11:47 +000019# Includes the main framework source to ensure that doclava has access to the
20# visibility information for the base classes of the mock classes. Without it
21# otherwise hidden methods could be visible.
22android_test_mock_source_files := \
23 $(call all-java-files-under, src/android/test/mock) \
24 $(call all-java-files-under, ../core/java) \
Paul Duffine2545262017-11-15 11:39:14 +000025
Paul Duffine2545262017-11-15 11:39:14 +000026# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
27ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
28
29# Generate the stub source files for android.test.mock.stubs
30# ==========================================================
31include $(CLEAR_VARS)
32LOCAL_SRC_FILES := $(android_test_mock_source_files)
33
34LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
35LOCAL_MODULE_CLASS := JAVA_LIBRARIES
36LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock
37
38ANDROID_TEST_MOCK_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/api.txt
39ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/removed.txt
40
41ANDROID_TEST_MOCK_API_FILE := $(LOCAL_PATH)/api/android-test-mock-current.txt
42ANDROID_TEST_MOCK_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-removed.txt
43
44LOCAL_DROIDDOC_OPTIONS:= \
45 -stubpackages android.test.mock \
46 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/src \
47 -nodocs \
48 -api $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) \
49 -removedApi $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) \
50
51LOCAL_UNINSTALLABLE_MODULE := true
52LOCAL_MODULE := android-test-mock-api-stubs-gen
53
54include $(BUILD_DROIDDOC)
55
56# Remember the target that will trigger the code generation.
57android_test_mock_gen_stamp := $(full_target)
58
59# Add some additional dependencies
60$(ANDROID_TEST_MOCK_OUTPUT_API_FILE): $(full_target)
61$(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE): $(full_target)
62
63# Build the android.test.mock.stubs library
64# =========================================
65include $(CLEAR_VARS)
66
67LOCAL_MODULE := android.test.mock.stubs
68
69LOCAL_SOURCE_FILES_ALL_GENERATED := true
70
71# Make sure to run droiddoc first to generate the stub source files.
72LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_gen_stamp)
73android_test_mock_gen_stamp :=
74
Paul Duffinbd97e3d2017-12-19 15:11:47 +000075LOCAL_SDK_VERSION := current
76
Paul Duffine2545262017-11-15 11:39:14 +000077include $(BUILD_STATIC_JAVA_LIBRARY)
78
79# Archive a copy of the classes.jar in SDK build.
80$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.mock.stubs.jar)
81
82# Check that the android.test.mock.stubs library has not changed
83# ==============================================================
84
85# Check that the API we're building hasn't changed from the not-yet-released
86# SDK version.
87$(eval $(call check-api, \
88 check-android-test-mock-api-current, \
89 $(ANDROID_TEST_MOCK_API_FILE), \
90 $(ANDROID_TEST_MOCK_OUTPUT_API_FILE), \
91 $(ANDROID_TEST_MOCK_REMOVED_API_FILE), \
92 $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE), \
93 -error 2 -error 3 -error 4 -error 5 -error 6 \
94 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
95 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
96 -error 25 -error 26 -error 27, \
97 cat $(LOCAL_PATH)/api/apicheck_msg_android_test_mock.txt, \
98 check-android-test-mock-api, \
99 $(call doc-timestamp-for,android-test-mock-api-stubs-gen) \
100 ))
101
102.PHONY: check-android-test-mock-api
103checkapi: check-android-test-mock-api
104
105.PHONY: update-android-test-mock-api
106update-api: update-android-test-mock-api
107
108update-android-test-mock-api: $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) | $(ACP)
109 @echo Copying current.txt
110 $(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) $(ANDROID_TEST_MOCK_API_FILE)
111 @echo Copying removed.txt
112 $(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_MOCK_REMOVED_API_FILE)
113
Paul Duffina23c84c2017-12-15 12:49:36 +0000114# Generate the stub source files for android.test.mock.stubs-system
115# =================================================================
116include $(CLEAR_VARS)
117LOCAL_SRC_FILES := $(android_test_mock_source_files)
118
119LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
120LOCAL_MODULE_CLASS := JAVA_LIBRARIES
121LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock
122
123ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs-system_intermediates/api.txt
124ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs-system_intermediates/removed.txt
125
126ANDROID_TEST_MOCK_SYSTEM_API_FILE := $(LOCAL_PATH)/api/android-test-mock-system-current.txt
127ANDROID_TEST_MOCK_SYSTEM_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-system-removed.txt
128
129LOCAL_DROIDDOC_OPTIONS:= \
130 -stubpackages android.test.mock \
131 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs-system_intermediates/src \
132 -nodocs \
133 -showAnnotation android.annotation.SystemApi \
134 -api $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE) \
135 -removedApi $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE) \
136
137LOCAL_UNINSTALLABLE_MODULE := true
138LOCAL_MODULE := android-test-mock-system-api-stubs-gen
139
140include $(BUILD_DROIDDOC)
141
142# Remember the target that will trigger the code generation.
143android_test_mock_system_gen_stamp := $(full_target)
144
145# Add some additional dependencies
146$(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE): $(full_target)
147$(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE): $(full_target)
148
149# Build the android.test.mock.stubs-system library
150# ================================================
151include $(CLEAR_VARS)
152
153LOCAL_MODULE := android.test.mock.stubs-system
154
155LOCAL_SOURCE_FILES_ALL_GENERATED := true
156
157# Make sure to run droiddoc first to generate the stub source files.
158LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_system_gen_stamp)
159android_test_mock_system_gen_stamp :=
160
161LOCAL_SDK_VERSION := system_current
162
163include $(BUILD_STATIC_JAVA_LIBRARY)
164
165# Archive a copy of the classes.jar in SDK build.
166$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.mock.stubs_system.jar)
167
168# Check that the android.test.mock.stubs-system library has not changed
169# =====================================================================
170
171# Check that the API we're building hasn't changed from the not-yet-released
172# SDK version.
173$(eval $(call check-api, \
174 check-android-test-mock-system-api-current, \
175 $(ANDROID_TEST_MOCK_SYSTEM_API_FILE), \
176 $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE), \
177 $(ANDROID_TEST_MOCK_SYSTEM_REMOVED_API_FILE), \
178 $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE), \
179 -error 2 -error 3 -error 4 -error 5 -error 6 \
180 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
181 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
182 -error 25 -error 26 -error 27, \
183 cat $(LOCAL_PATH)/api/apicheck_msg_android_test_mock-system.txt, \
184 check-android-test-mock-system-api, \
185 $(call doc-timestamp-for,android-test-mock-system-api-stubs-gen) \
186 ))
187
188.PHONY: check-android-test-mock-system-api
189checkapi: check-android-test-mock-system-api
190
191.PHONY: update-android-test-mock-system-api
192update-api: update-android-test-mock-system-api
193
194update-android-test-mock-system-api: $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE) | $(ACP)
195 @echo Copying current.txt
196 $(hide) $(ACP) $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE) $(ANDROID_TEST_MOCK_SYSTEM_API_FILE)
197 @echo Copying removed.txt
198 $(hide) $(ACP) $(ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_MOCK_SYSTEM_REMOVED_API_FILE)
199
Paul Duffine2545262017-11-15 11:39:14 +0000200endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true
Paul Duffina23c84c2017-12-15 12:49:36 +0000201