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