Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | LOCAL_PATH:= $(call my-dir) |
| 18 | |
Paul Duffin | bd97e3d | 2017-12-19 15:11:47 +0000 | [diff] [blame] | 19 | # 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. |
| 22 | android_test_mock_source_files := \ |
| 23 | $(call all-java-files-under, src/android/test/mock) \ |
Paul Duffin | 001d87c | 2018-02-14 10:36:16 +0000 | [diff] [blame^] | 24 | $(call all-java-files-under, ../core/java/android) |
Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 25 | |
Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 26 | # For unbundled build we'll use the prebuilt jar from prebuilts/sdk. |
| 27 | ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) |
| 28 | |
| 29 | # Generate the stub source files for android.test.mock.stubs |
| 30 | # ========================================================== |
| 31 | include $(CLEAR_VARS) |
| 32 | LOCAL_SRC_FILES := $(android_test_mock_source_files) |
Jiyong Park | 97ca19f | 2018-01-26 14:29:18 +0900 | [diff] [blame] | 33 | LOCAL_JAVA_LIBRARIES := core-oj core-libart framework conscrypt okhttp bouncycastle |
Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 34 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 35 | LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock |
| 36 | |
| 37 | ANDROID_TEST_MOCK_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/api.txt |
| 38 | ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/removed.txt |
| 39 | |
| 40 | ANDROID_TEST_MOCK_API_FILE := $(LOCAL_PATH)/api/android-test-mock-current.txt |
| 41 | ANDROID_TEST_MOCK_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-removed.txt |
| 42 | |
| 43 | LOCAL_DROIDDOC_OPTIONS:= \ |
Paul Duffin | 001d87c | 2018-02-14 10:36:16 +0000 | [diff] [blame^] | 44 | -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 \ |
Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 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 | |
| 51 | LOCAL_UNINSTALLABLE_MODULE := true |
| 52 | LOCAL_MODULE := android-test-mock-api-stubs-gen |
| 53 | |
| 54 | include $(BUILD_DROIDDOC) |
| 55 | |
| 56 | # Remember the target that will trigger the code generation. |
| 57 | android_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 | # ========================================= |
| 65 | include $(CLEAR_VARS) |
| 66 | |
| 67 | LOCAL_MODULE := android.test.mock.stubs |
| 68 | |
| 69 | LOCAL_SOURCE_FILES_ALL_GENERATED := true |
| 70 | |
| 71 | # Make sure to run droiddoc first to generate the stub source files. |
| 72 | LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_gen_stamp) |
| 73 | android_test_mock_gen_stamp := |
| 74 | |
Paul Duffin | bd97e3d | 2017-12-19 15:11:47 +0000 | [diff] [blame] | 75 | LOCAL_SDK_VERSION := current |
| 76 | |
Paul Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 77 | include $(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 |
| 103 | checkapi: check-android-test-mock-api |
| 104 | |
| 105 | .PHONY: update-android-test-mock-api |
| 106 | update-api: update-android-test-mock-api |
| 107 | |
| 108 | update-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 Duffin | a23c84c | 2017-12-15 12:49:36 +0000 | [diff] [blame] | 114 | # Generate the stub source files for android.test.mock.stubs-system |
| 115 | # ================================================================= |
| 116 | include $(CLEAR_VARS) |
| 117 | LOCAL_SRC_FILES := $(android_test_mock_source_files) |
| 118 | |
Jiyong Park | 97ca19f | 2018-01-26 14:29:18 +0900 | [diff] [blame] | 119 | LOCAL_JAVA_LIBRARIES := core-oj core-libart framework conscrypt okhttp bouncycastle |
Paul Duffin | a23c84c | 2017-12-15 12:49:36 +0000 | [diff] [blame] | 120 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 121 | LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock |
| 122 | |
| 123 | ANDROID_TEST_MOCK_SYSTEM_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs-system_intermediates/api.txt |
| 124 | ANDROID_TEST_MOCK_SYSTEM_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs-system_intermediates/removed.txt |
| 125 | |
| 126 | ANDROID_TEST_MOCK_SYSTEM_API_FILE := $(LOCAL_PATH)/api/android-test-mock-system-current.txt |
| 127 | ANDROID_TEST_MOCK_SYSTEM_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-system-removed.txt |
| 128 | |
| 129 | LOCAL_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 | |
| 137 | LOCAL_UNINSTALLABLE_MODULE := true |
| 138 | LOCAL_MODULE := android-test-mock-system-api-stubs-gen |
| 139 | |
| 140 | include $(BUILD_DROIDDOC) |
| 141 | |
| 142 | # Remember the target that will trigger the code generation. |
| 143 | android_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 | # ================================================ |
| 151 | include $(CLEAR_VARS) |
| 152 | |
| 153 | LOCAL_MODULE := android.test.mock.stubs-system |
| 154 | |
| 155 | LOCAL_SOURCE_FILES_ALL_GENERATED := true |
| 156 | |
| 157 | # Make sure to run droiddoc first to generate the stub source files. |
| 158 | LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_system_gen_stamp) |
| 159 | android_test_mock_system_gen_stamp := |
| 160 | |
| 161 | LOCAL_SDK_VERSION := system_current |
| 162 | |
| 163 | include $(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 |
| 189 | checkapi: check-android-test-mock-system-api |
| 190 | |
| 191 | .PHONY: update-android-test-mock-system-api |
| 192 | update-api: update-android-test-mock-system-api |
| 193 | |
| 194 | update-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 Duffin | e254526 | 2017-11-15 11:39:14 +0000 | [diff] [blame] | 200 | endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true |
Paul Duffin | a23c84c | 2017-12-15 12:49:36 +0000 | [diff] [blame] | 201 | |