Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2012 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 | uiautomator.core_src_files := $(call all-java-files-under, core-src) \ |
| 20 | $(call all-java-files-under, testrunner-src) |
| 21 | uiautomator.core_java_libraries := android.test.runner core-junit |
| 22 | |
| 23 | uiautomator_internal_api_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/uiautomator_api.txt |
| 24 | uiautomator_internal_removed_api_file := \ |
| 25 | $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/uiautomator_removed_api.txt |
| 26 | |
| 27 | ############################################### |
| 28 | include $(CLEAR_VARS) |
| 29 | LOCAL_SRC_FILES := $(uiautomator.core_src_files) |
| 30 | LOCAL_MODULE := uiautomator.core |
| 31 | LOCAL_JAVA_LIBRARIES := android.test.runner |
| 32 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 33 | |
| 34 | ############################################### |
| 35 | # Generate the stub source files |
| 36 | include $(CLEAR_VARS) |
| 37 | LOCAL_SRC_FILES := $(uiautomator.core_src_files) |
| 38 | LOCAL_JAVA_LIBRARIES := $(uiautomator.core_java_libraries) |
| 39 | LOCAL_MODULE_CLASS := JAVA_LIBRARIES |
| 40 | LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/core-src \ |
| 41 | $(LOCAL_PATH)/testrunner-src |
| 42 | LOCAL_DROIDDOC_HTML_DIR := |
| 43 | |
Ying Wang | 0f92a2e | 2015-07-16 14:20:22 -0700 | [diff] [blame] | 44 | LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/src |
| 45 | |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 46 | LOCAL_DROIDDOC_OPTIONS:= \ |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 47 | -stubpackages com.android.uiautomator.core:com.android.uiautomator.testrunner \ |
| 48 | -api $(uiautomator_internal_api_file) \ |
| 49 | -removedApi $(uiautomator_internal_removed_api_file) |
| 50 | |
| 51 | LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk |
| 52 | LOCAL_UNINSTALLABLE_MODULE := true |
| 53 | |
| 54 | LOCAL_MODULE := uiautomator-stubs |
| 55 | |
| 56 | include $(BUILD_DROIDDOC) |
| 57 | uiautomator_stubs_stamp := $(full_target) |
| 58 | $(uiautomator_internal_api_file) : $(full_target) |
| 59 | |
| 60 | ############################################### |
| 61 | # Build the stub source files into a jar. |
| 62 | include $(CLEAR_VARS) |
| 63 | LOCAL_MODULE := android_uiautomator |
| 64 | LOCAL_JAVA_LIBRARIES := $(uiautomator.core_java_libraries) |
| 65 | LOCAL_SOURCE_FILES_ALL_GENERATED := true |
| 66 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 67 | # Make sure to run droiddoc first to generate the stub source files. |
| 68 | $(full_classes_compiled_jar) : $(uiautomator_stubs_stamp) |
Guang Zhu | 0d09166 | 2014-12-13 23:09:56 -0800 | [diff] [blame] | 69 | $(built_dex_intermediate) : $(uiautomator_stubs_stamp) |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 70 | uiautomator_stubs_jar := $(full_classes_compiled_jar) |
| 71 | |
| 72 | ############################################### |
| 73 | # API check |
| 74 | # Please refer to build/core/tasks/apicheck.mk. |
| 75 | uiautomator_api_dir := frameworks/base/cmds/uiautomator/api |
| 76 | last_released_sdk_version := $(lastword $(call numerically_sort, \ |
| 77 | $(filter-out current, \ |
| 78 | $(patsubst $(uiautomator_api_dir)/%.txt,%, $(wildcard $(uiautomator_api_dir)/*.txt)) \ |
| 79 | ))) |
| 80 | |
| 81 | checkapi_last_error_level_flags := \ |
| 82 | -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \ |
| 83 | -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ |
| 84 | -error 16 -error 17 -error 18 |
| 85 | |
| 86 | # Check that the API we're building hasn't broken the last-released SDK version. |
| 87 | $(eval $(call check-api, \ |
| 88 | uiautomator-checkapi-last, \ |
| 89 | $(uiautomator_api_dir)/$(last_released_sdk_version).txt, \ |
| 90 | $(uiautomator_internal_api_file), \ |
| 91 | $(uiautomator_api_dir)/removed.txt, \ |
| 92 | $(uiautomator_internal_removed_api_file), \ |
| 93 | $(checkapi_last_error_level_flags), \ |
| 94 | cat $(LOCAL_PATH)/apicheck_msg_last.txt, \ |
| 95 | $(uiautomator_stubs_jar), \ |
| 96 | $(uiautomator_stubs_stamp))) |
| 97 | |
| 98 | checkapi_current_error_level_flags := \ |
| 99 | -error 2 -error 3 -error 4 -error 5 -error 6 \ |
| 100 | -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ |
| 101 | -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ |
| 102 | -error 25 |
| 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 | uiautomator-checkapi-current, \ |
| 108 | $(uiautomator_api_dir)/current.txt, \ |
| 109 | $(uiautomator_internal_api_file), \ |
| 110 | $(uiautomator_api_dir)/removed.txt, \ |
| 111 | $(uiautomator_internal_removed_api_file), \ |
| 112 | $(checkapi_current_error_level_flags), \ |
| 113 | cat $(LOCAL_PATH)/apicheck_msg_current.txt, \ |
| 114 | $(uiautomator_stubs_jar), \ |
| 115 | $(uiautomator_stubs_stamp))) |
| 116 | |
| 117 | .PHONY: update-uiautomator-api |
| 118 | update-uiautomator-api: PRIVATE_API_DIR := $(uiautomator_api_dir) |
| 119 | update-uiautomator-api: PRIVATE_REMOVED_API_FILE := $(uiautomator_internal_removed_api_file) |
Dan Willemsen | 98ff0b7 | 2016-03-23 00:42:44 -0700 | [diff] [blame] | 120 | update-uiautomator-api: $(uiautomator_internal_api_file) |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 121 | @echo Copying uiautomator current.txt |
Dan Willemsen | 98ff0b7 | 2016-03-23 00:42:44 -0700 | [diff] [blame] | 122 | $(hide) cp $< $(PRIVATE_API_DIR)/current.txt |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 123 | @echo Copying uiautomator removed.txt |
Dan Willemsen | 98ff0b7 | 2016-03-23 00:42:44 -0700 | [diff] [blame] | 124 | $(hide) cp $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt |
Guang Zhu | 18b892c | 2014-12-11 15:12:30 -0800 | [diff] [blame] | 125 | ############################################### |
| 126 | # clean up temp vars |
| 127 | uiautomator.core_src_files := |
| 128 | uiautomator.core_java_libraries := |
| 129 | uiautomator_stubs_stamp := |
| 130 | uiautomator_internal_api_file := |
| 131 | uiautomator_stubs_jar := |
| 132 | uiautomator_api_dir := |
| 133 | checkapi_last_error_level_flags := |
| 134 | checkapi_current_error_level_flags := |