summaryrefslogtreecommitdiff
path: root/Android.mk
blob: 897c6e8738b29729eff4709f945d5c955bc3dc2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH:= $(call my-dir)

uiautomator_internal_api_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/uiautomator_api.txt

###############################################
# Build core library
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := ub-uiautomator
LOCAL_SDK_VERSION := current

gen := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/BuildConstants.java
$(gen) : $(LOCAL_PATH)/BuildConstants.java.in
	@echo Generating: $@
	@ mkdir -p $(dir $@)
	$(hide) sed -e 's/%BUILD_NUMBER%/$(BUILD_NUMBER)/' \
		$< > $@

LOCAL_GENERATED_SOURCES += $(gen)


include $(BUILD_STATIC_JAVA_LIBRARY)
# establish dependency on apicheck
uiautomator_library := $(LOCAL_BUILT_MODULE)
###############################################


###############################################
# Generate the stub source files
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_MODULE_CLASS := DOCS
LOCAL_DROIDDOC_HTML_DIR :=
LOCAL_DROIDDOC_OPTIONS:= \
    -stubpackages com.android.uiautomator.core:com.android.uiautomator.testrunner \
    -api $(uiautomator_internal_api_file)
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk

LOCAL_MODULE := ub-uiautomator-docs

include $(BUILD_DROIDDOC)

uiautomator_stubs_stamp := $(full_target)
$(uiautomator_internal_api_file) : $(full_target)

###############################################
# API check
# Please refer to build/core/tasks/apicheck.mk.
uiautomator_api_dir := frameworks/uiautomator/api
last_released_sdk_version := $(lastword $(call numerically_sort, \
    $(filter-out current, \
        $(patsubst $(uiautomator_api_dir)/%.txt,%, $(wildcard $(uiautomator_api_dir)/*.txt)) \
    )))

checkapi_last_error_level_flags := \
    -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \
    -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
    -error 16 -error 17 -error 18

# Check that the API we're building hasn't broken the last-released SDK version.
$(eval $(call check-api, \
    uiautomator-checkapi-last, \
    $(uiautomator_api_dir)/$(last_released_sdk_version).txt, \
    $(uiautomator_internal_api_file), \
    $(checkapi_last_error_level_flags), \
    cat $(LOCAL_PATH)/apicheck_msg_last.txt, \
    $(uiautomator_library), \
    $(uiautomator_stubs_stamp)))

checkapi_current_error_level_flags := \
    -error 2 -error 3 -error 4 -error 5 -error 6 \
    -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
    -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
    -error 25

# Check that the API we're building hasn't changed from the not-yet-released
# SDK version.
$(eval $(call check-api, \
    uiautomator-checkapi-current, \
    $(uiautomator_api_dir)/current.txt, \
    $(uiautomator_internal_api_file), \
    $(checkapi_current_error_level_flags), \
    cat $(LOCAL_PATH)/apicheck_msg_current.txt, \
    $(uiautomator_library), \
    $(uiautomator_stubs_stamp)))

.PHONY: update-uiautomator-api
update-uiautomator-api: PRIVATE_API_DIR := $(uiautomator_api_dir)
update-uiautomator-api: $(uiautomator_internal_api_file) | $(ACP)
	@echo Copying uiautomator current.txt
	$(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt

###############################################
# clean up temp vars
uiautomator_stubs_stamp :=
uiautomator_internal_api_file :=
uiautomator_library :=
uiautomator_api_dir :=
checkapi_last_error_level_flags :=
checkapi_current_error_level_flags :=