blob: df9af7ca64a69c3c3235253ad83e8bdd3acd8d0f [file] [log] [blame]
Vitalii Tomkiv280b5722016-03-17 16:17:21 -07001# Copyright (C) 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Input variables
17#
18# $(car_module) - name of the car library module
19# $(car_module_api_dir) - dir to store API files
20# $(car_module_include_systemapi) - if systemApi file should be generated
21# $(car_module_java_libraries) - dependent libraries
22# $(car_module_java_packages) - list of package names containing public classes
23# $(car_module_src_files) - list of source files
24# $(api_check_current_msg_file) - file containing error message for current API check
25# $(api_check_last_msg_file) - file containing error message for last SDK API check
26# ---------------------------------------------
27
28ifeq ($(BOARD_IS_AUTOMOTIVE), true)
29ifneq ($(TARGET_BUILD_PDK), true)
30#
31# Generate the public stub source files
32# ---------------------------------------------
33include $(CLEAR_VARS)
34
35car_module_api_file := \
36 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_api.txt
37car_module_removed_file := \
38 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_removed.txt
39
40LOCAL_MODULE := $(car_module)-stubs
41LOCAL_MODULE_CLASS := JAVA_LIBRARIES
42LOCAL_MODULE_TAGS := optional
43
44LOCAL_SRC_FILES := $(car_module_src_files)
45LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module)
46LOCAL_ADDITIONAL_JAVA_DIR := \
47 $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src
48LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION)
49
50LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src
51
52LOCAL_DROIDDOC_OPTIONS:= \
53 -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \
54 -api $(car_module_api_file) \
55 -removedApi $(car_module_removed_file) \
56 -nodocs \
57 -hide 113 \
58 -hide 110
59LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk
60LOCAL_UNINSTALLABLE_MODULE := true
61
62include $(BUILD_DROIDDOC)
63car_stub_stamp := $(full_target)
64$(car_module_api_file) : $(full_target)
65
66ifeq ($(car_module_include_systemapi), true)
67#
68# Generate the system stub source files
69# ---------------------------------------------
70include $(CLEAR_VARS)
71
72car_module_system_api_file := \
73 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_api.txt
74car_module_system_removed_file := \
75 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_removed.txt
76
77LOCAL_MODULE := $(car_module)-system-stubs
78LOCAL_MODULE_CLASS := JAVA_LIBRARIES
79LOCAL_MODULE_TAGS := optional
80
81LOCAL_SRC_FILES := $(car_module_src_files)
82LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module)
83LOCAL_ADDITIONAL_JAVA_DIR := \
84 $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src
85LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION)
86
87LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src
88
89LOCAL_DROIDDOC_OPTIONS:= \
90 -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \
91 -showAnnotation android.annotation.SystemApi \
92 -api $(car_module_system_api_file) \
93 -removedApi $(car_module_system_removed_file) \
94 -nodocs \
95 -hide 113 \
96 -hide 110
97LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-sdk
98LOCAL_UNINSTALLABLE_MODULE := true
99
100include $(BUILD_DROIDDOC)
101car_system_stub_stamp := $(full_target)
102$(car_module_system_api_file) : $(full_target)
103
104#($(car_module_include_systemapi), true)
105endif
106#
107# Check public API
108# ---------------------------------------------
109.PHONY: $(car_module)-check-public-api
110checkapi: $(car_module)-check-public-api
111$(car_module): $(car_module)-check-public-api
112
113last_released_sdk_$(car_module) := $(lastword $(call numerically_sort, \
114 $(filter-out current, \
115 $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/*.txt)) \
116 )))
117
118# Check that the API we're building hasn't broken the last-released SDK version
119# if it exists
120ifneq ($(last_released_sdk_$(car_module)),)
121$(eval $(call check-api, \
122 $(car_module)-checkapi-last, \
123 $(car_module_api_dir)/$(last_released_sdk_$(car_module)).txt, \
124 $(car_module_api_file), \
125 $(car_module_api_dir)/removed.txt, \
126 $(car_module_removed_file), \
127 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
128 -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \
129 -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \
130 cat $(api_check_last_msg_file), \
131 $(car_module)-check-public-api, \
132 $(car_stub_stamp)))
133endif
134
135# Check that the API we're building hasn't changed from the not-yet-released
136# SDK version.
137$(eval $(call check-api, \
138 $(car_module)-checkapi-current, \
139 $(car_module_api_dir)/current.txt, \
140 $(car_module_api_file), \
141 $(car_module_api_dir)/removed.txt, \
142 $(car_module_removed_file), \
143 -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \
144 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \
145 -error 21 -error 23 -error 24 -error 25 -hide 113, \
146 cat $(api_check_current_msg_file), \
147 $(car_module)-check-public-api, \
148 $(car_stub_stamp)))
149
150.PHONY: update-$(car_module)-api
151update-$(car_module)-api: PRIVATE_API_DIR := $(car_module_api_dir)
152update-$(car_module)-api: PRIVATE_MODULE := $(car_module)
153update-$(car_module)-api: PRIVATE_REMOVED_API_FILE := $(car_module_removed_file)
154update-$(car_module)-api: $(car_module_api_file) | $(ACP)
155 @echo Copying $(PRIVATE_MODULE) current.txt
156 $(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt
157 @echo Copying $(PRIVATE_MODULE) removed.txt
158 $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt
159
160# Run this update API task on the update-car-api task
161update-car-api: update-$(car_module)-api
162
163ifeq ($(car_module_include_systemapi), true)
164
165#
166# Check system API
167# ---------------------------------------------
168.PHONY: $(car_module)-check-system-api
169checkapi: $(car_module)-check-system-api
170$(car_module): $(car_module)-check-system-api
171
172last_released_system_sdk_$(car_module) := $(lastword $(call numerically_sort, \
173 $(filter-out system-current, \
174 $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/system-*.txt)) \
175 )))
176
177# Check that the API we're building hasn't broken the last-released SDK version
178# if it exists
179ifneq ($(last_released_system_sdk_$(car_module)),)
180$(eval $(call check-api, \
181 $(car_module)-checksystemapi-last, \
182 $(car_module_api_dir)/$(last_released_system_sdk_$(car_module)).txt, \
183 $(car_module_system_api_file), \
184 $(car_module_api_dir)/system-removed.txt, \
185 $(car_module_system_removed_file), \
186 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
187 -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \
188 -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \
189 cat $(api_check_last_msg_file), \
190 $(car_module)-check-system-api, \
191 $(car_system_stub_stamp)))
192endif
193
194# Check that the API we're building hasn't changed from the not-yet-released
195# SDK version.
196$(eval $(call check-api, \
197 $(car_module)-checksystemapi-current, \
198 $(car_module_api_dir)/system-current.txt, \
199 $(car_module_system_api_file), \
200 $(car_module_api_dir)/system-removed.txt, \
201 $(car_module_system_removed_file), \
202 -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \
203 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \
204 -error 21 -error 23 -error 24 -error 25 -hide 113, \
205 cat $(api_check_current_msg_file), \
206 $(car_module)-check-system-api, \
207 $(car_stub_stamp)))
208
209.PHONY: update-$(car_module)-system-api
210update-$(car_module)-system-api: PRIVATE_API_DIR := $(car_module_api_dir)
211update-$(car_module)-system-api: PRIVATE_MODULE := $(car_module)
212update-$(car_module)-system-api: PRIVATE_REMOVED_API_FILE := $(car_module_system_removed_file)
213update-$(car_module)-system-api: $(car_module_system_api_file) | $(ACP)
214 @echo Copying $(PRIVATE_MODULE) system-current.txt
215 $(hide) $(ACP) $< $(PRIVATE_API_DIR)/system-current.txt
216 @echo Copying $(PRIVATE_MODULE) system-removed.txt
217 $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/system-removed.txt
218
219# Run this update API task on the update-car-api task
220update-car-api: update-$(car_module)-system-api
221
222#($(car_module_include_systemapi), true)
223endif
224
225#($(TARGET_BUILD_PDK),true)
226endif
227
228#($(BOARD_IS_AUTOMOTIVE), true)
229endif
230#
231# Clear variables
232# ---------------------------------------------
233car_module :=
234car_module_api_dir :=
235car_module_src_files :=
236car_module_java_libraries :=
237car_module_java_packages :=
238car_module_api_file :=
239car_module_removed_file :=
240car_module_system_api_file :=
241car_module_system_removed__file :=
242car_stub_stamp :=
243car_system_stub_stamp :=
244car_module_include_systemapi :=