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 | |
| 19 | android_test_mock_source_files := $(call all-java-files-under, src/android/test/mock) |
| 20 | |
| 21 | # Build the repackaged.android.test.mock library |
| 22 | # ============================================== |
| 23 | include $(CLEAR_VARS) |
| 24 | |
| 25 | LOCAL_SRC_FILES := $(call all-java-files-under, src) |
| 26 | |
| 27 | LOCAL_JAVA_LIBRARIES := core-oj core-libart framework legacy-test |
| 28 | |
| 29 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/../legacy-test/jarjar-rules.txt |
| 30 | |
| 31 | LOCAL_MODULE:= repackaged.android.test.mock |
| 32 | |
| 33 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 34 | |
| 35 | # Build the android.test.mock library |
| 36 | # =================================== |
| 37 | include $(CLEAR_VARS) |
| 38 | |
| 39 | LOCAL_SRC_FILES := $(call all-java-files-under, src) |
| 40 | |
| 41 | LOCAL_JAVA_LIBRARIES := core-oj core-libart framework |
| 42 | |
| 43 | LOCAL_MODULE:= android.test.mock |
| 44 | |
| 45 | include $(BUILD_JAVA_LIBRARY) |
| 46 | |
| 47 | # For unbundled build we'll use the prebuilt jar from prebuilts/sdk. |
| 48 | ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) |
| 49 | |
| 50 | # Generate the stub source files for android.test.mock.stubs |
| 51 | # ========================================================== |
| 52 | include $(CLEAR_VARS) |
| 53 | LOCAL_SRC_FILES := $(android_test_mock_source_files) |
| 54 | |
| 55 | LOCAL_JAVA_LIBRARIES := core-oj core-libart framework |
| 56 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 57 | LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock |
| 58 | |
| 59 | ANDROID_TEST_MOCK_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/api.txt |
| 60 | ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/removed.txt |
| 61 | |
| 62 | ANDROID_TEST_MOCK_API_FILE := $(LOCAL_PATH)/api/android-test-mock-current.txt |
| 63 | ANDROID_TEST_MOCK_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-removed.txt |
| 64 | |
| 65 | LOCAL_DROIDDOC_OPTIONS:= \ |
| 66 | -stubpackages android.test.mock \ |
| 67 | -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/src \ |
| 68 | -nodocs \ |
| 69 | -api $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) \ |
| 70 | -removedApi $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) \ |
| 71 | |
| 72 | LOCAL_UNINSTALLABLE_MODULE := true |
| 73 | LOCAL_MODULE := android-test-mock-api-stubs-gen |
| 74 | |
| 75 | include $(BUILD_DROIDDOC) |
| 76 | |
| 77 | # Remember the target that will trigger the code generation. |
| 78 | android_test_mock_gen_stamp := $(full_target) |
| 79 | |
| 80 | # Add some additional dependencies |
| 81 | $(ANDROID_TEST_MOCK_OUTPUT_API_FILE): $(full_target) |
| 82 | $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE): $(full_target) |
| 83 | |
| 84 | # Build the android.test.mock.stubs library |
| 85 | # ========================================= |
| 86 | include $(CLEAR_VARS) |
| 87 | |
| 88 | LOCAL_MODULE := android.test.mock.stubs |
| 89 | |
| 90 | LOCAL_SOURCE_FILES_ALL_GENERATED := true |
| 91 | |
| 92 | # Make sure to run droiddoc first to generate the stub source files. |
| 93 | LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_gen_stamp) |
| 94 | android_test_mock_gen_stamp := |
| 95 | |
| 96 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 97 | |
| 98 | # Archive a copy of the classes.jar in SDK build. |
| 99 | $(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.mock.stubs.jar) |
| 100 | |
| 101 | # Check that the android.test.mock.stubs library has not changed |
| 102 | # ============================================================== |
| 103 | |
| 104 | # Check that the API we're building hasn't changed from the not-yet-released |
| 105 | # SDK version. |
| 106 | $(eval $(call check-api, \ |
| 107 | check-android-test-mock-api-current, \ |
| 108 | $(ANDROID_TEST_MOCK_API_FILE), \ |
| 109 | $(ANDROID_TEST_MOCK_OUTPUT_API_FILE), \ |
| 110 | $(ANDROID_TEST_MOCK_REMOVED_API_FILE), \ |
| 111 | $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE), \ |
| 112 | -error 2 -error 3 -error 4 -error 5 -error 6 \ |
| 113 | -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ |
| 114 | -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ |
| 115 | -error 25 -error 26 -error 27, \ |
| 116 | cat $(LOCAL_PATH)/api/apicheck_msg_android_test_mock.txt, \ |
| 117 | check-android-test-mock-api, \ |
| 118 | $(call doc-timestamp-for,android-test-mock-api-stubs-gen) \ |
| 119 | )) |
| 120 | |
| 121 | .PHONY: check-android-test-mock-api |
| 122 | checkapi: check-android-test-mock-api |
| 123 | |
| 124 | .PHONY: update-android-test-mock-api |
| 125 | update-api: update-android-test-mock-api |
| 126 | |
| 127 | update-android-test-mock-api: $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) | $(ACP) |
| 128 | @echo Copying current.txt |
| 129 | $(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) $(ANDROID_TEST_MOCK_API_FILE) |
| 130 | @echo Copying removed.txt |
| 131 | $(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_MOCK_REMOVED_API_FILE) |
| 132 | |
| 133 | # Build the android.test.mock.sdk library |
| 134 | # ======================================= |
| 135 | include $(CLEAR_VARS) |
| 136 | |
| 137 | LOCAL_MODULE := android.test.mock.sdk |
| 138 | LOCAL_SDK_VERSION := current |
| 139 | |
| 140 | LOCAL_STATIC_JAVA_LIBRARIES := android.test.mock.stubs |
| 141 | |
| 142 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 143 | |
| 144 | endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true |