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