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 17LOCAL_PATH:= $(call my-dir) 18 19uiautomator.core_src_files := $(call all-java-files-under, src) 20uiautomator.core_java_libraries := android.test.runner core-junit 21 22uiautomator_internal_api_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/uiautomator_api.txt 23 24############################################### 25include $(CLEAR_VARS) 26LOCAL_SRC_FILES := $(uiautomator.core_src_files) 27LOCAL_MODULE := uiautomator.core 28LOCAL_JAVA_LIBRARIES := android.test.runner 29include $(BUILD_STATIC_JAVA_LIBRARY) 30 31############################################### 32# Generate the stub source files 33include $(CLEAR_VARS) 34LOCAL_SRC_FILES := $(uiautomator.core_src_files) 35LOCAL_JAVA_LIBRARIES := $(uiautomator.core_java_libraries) 36LOCAL_MODULE_CLASS := JAVA_LIBRARIES 37LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src 38LOCAL_DROIDDOC_HTML_DIR := 39 40LOCAL_DROIDDOC_OPTIONS:= \ 41 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_uiautomator_intermediates/src \ 42 -stubpackages com.android.uiautomator.core:com.android.uiautomator.testrunner \ 43 -api $(uiautomator_internal_api_file) \ 44 -nodocs 45 46LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk 47LOCAL_UNINSTALLABLE_MODULE := true 48 49LOCAL_MODULE := uiautomator-stubs 50 51include $(BUILD_DROIDDOC) 52uiautomator_stubs_stamp := $(full_target) 53$(uiautomator_internal_api_file) : $(full_target) 54 55############################################### 56# Build the stub source files into a jar. 57include $(CLEAR_VARS) 58LOCAL_MODULE := android_uiautomator 59LOCAL_JAVA_LIBRARIES := $(uiautomator.core_java_libraries) 60LOCAL_SOURCE_FILES_ALL_GENERATED := true 61include $(BUILD_STATIC_JAVA_LIBRARY) 62# Make sure to run droiddoc first to generate the stub source files. 63$(full_classes_compiled_jar) : $(uiautomator_stubs_stamp) 64uiautomator_stubs_jar := $(full_classes_compiled_jar) 65 66############################################### 67# API check 68# Please refer to build/core/tasks/apicheck.mk. 69uiautomator_api_dir := frameworks/testing/uiautomator/api 70last_released_sdk_version := $(lastword $(call numerically_sort, \ 71 $(filter-out current, \ 72 $(patsubst $(uiautomator_api_dir)/%.txt,%, $(wildcard $(uiautomator_api_dir)/*.txt)) \ 73 ))) 74 75checkapi_last_error_level_flags := \ 76 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \ 77 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ 78 -error 16 -error 17 -error 18 79 80# Check that the API we're building hasn't broken the last-released SDK version. 81$(eval $(call check-api, \ 82 uiautomator-checkapi-last, \ 83 $(uiautomator_api_dir)/$(last_released_sdk_version).txt, \ 84 $(uiautomator_internal_api_file), \ 85 $(checkapi_last_error_level_flags), \ 86 cat $(LOCAL_PATH)/apicheck_msg_last.txt, \ 87 $(uiautomator_stubs_jar), \ 88 $(uiautomator_stubs_stamp))) 89 90checkapi_current_error_level_flags := \ 91 -error 2 -error 3 -error 4 -error 5 -error 6 \ 92 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ 93 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \ 94 -error 25 95 96# Check that the API we're building hasn't changed from the not-yet-released 97# SDK version. 98$(eval $(call check-api, \ 99 uiautomator-checkapi-current, \ 100 $(uiautomator_api_dir)/current.txt, \ 101 $(uiautomator_internal_api_file), \ 102 $(checkapi_current_error_level_flags), \ 103 cat $(LOCAL_PATH)/apicheck_msg_current.txt, \ 104 $(uiautomator_stubs_jar), \ 105 $(uiautomator_stubs_stamp))) 106 107.PHONY: update-uiautomator-api 108update-uiautomator-api: PRIVATE_API_DIR := $(uiautomator_api_dir) 109update-uiautomator-api: $(uiautomator_internal_api_file) | $(ACP) 110 @echo Copying uiautomator current.txt 111 $(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt 112 113############################################### 114# clean up temp vars 115uiautomator.core_src_files := 116uiautomator.core_java_libraries := 117uiautomator_stubs_stamp := 118uiautomator_internal_api_file := 119uiautomator_stubs_jar := 120uiautomator_api_dir := 121checkapi_last_error_level_flags := 122checkapi_current_error_level_flags := 123