blob: b87c7d2ee693ef383acc5f03aa624714b24757af [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
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -080021# $(car_module_proguard_file) - where to output the proguard file, if empty no file will be produced
Vitalii Tomkiv280b5722016-03-17 16:17:21 -070022# $(car_module_java_libraries) - dependent libraries
23# $(car_module_java_packages) - list of package names containing public classes
24# $(car_module_src_files) - list of source files
25# $(api_check_current_msg_file) - file containing error message for current API check
26# $(api_check_last_msg_file) - file containing error message for last SDK API check
27# ---------------------------------------------
28
29ifeq ($(BOARD_IS_AUTOMOTIVE), true)
30ifneq ($(TARGET_BUILD_PDK), true)
31#
32# Generate the public stub source files
33# ---------------------------------------------
34include $(CLEAR_VARS)
35
36car_module_api_file := \
37 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_api.txt
38car_module_removed_file := \
39 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_removed.txt
40
41LOCAL_MODULE := $(car_module)-stubs
42LOCAL_MODULE_CLASS := JAVA_LIBRARIES
43LOCAL_MODULE_TAGS := optional
44
45LOCAL_SRC_FILES := $(car_module_src_files)
46LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module)
47LOCAL_ADDITIONAL_JAVA_DIR := \
48 $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src
49LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION)
50
51LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src
52
53LOCAL_DROIDDOC_OPTIONS:= \
54 -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \
55 -api $(car_module_api_file) \
56 -removedApi $(car_module_removed_file) \
57 -nodocs \
58 -hide 113 \
59 -hide 110
Scott Main96880382017-03-08 12:02:41 -080060LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := external/doclava/res/assets/templates-sdk
Vitalii Tomkiv280b5722016-03-17 16:17:21 -070061LOCAL_UNINSTALLABLE_MODULE := true
62
63include $(BUILD_DROIDDOC)
64car_stub_stamp := $(full_target)
65$(car_module_api_file) : $(full_target)
66
67ifeq ($(car_module_include_systemapi), true)
68#
69# Generate the system stub source files
70# ---------------------------------------------
71include $(CLEAR_VARS)
72
73car_module_system_api_file := \
74 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_api.txt
75car_module_system_removed_file := \
76 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(car_module)_system_removed.txt
77
78LOCAL_MODULE := $(car_module)-system-stubs
79LOCAL_MODULE_CLASS := JAVA_LIBRARIES
80LOCAL_MODULE_TAGS := optional
81
82LOCAL_SRC_FILES := $(car_module_src_files)
83LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module)
84LOCAL_ADDITIONAL_JAVA_DIR := \
85 $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src
86LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION)
87
88LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/src
89
90LOCAL_DROIDDOC_OPTIONS:= \
91 -stubpackages "$(subst $(space),:,$(car_module_java_packages))" \
92 -showAnnotation android.annotation.SystemApi \
93 -api $(car_module_system_api_file) \
94 -removedApi $(car_module_system_removed_file) \
95 -nodocs \
96 -hide 113 \
97 -hide 110
Scott Main96880382017-03-08 12:02:41 -080098LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := external/doclava/res/assets/templates-sdk
Vitalii Tomkiv280b5722016-03-17 16:17:21 -070099LOCAL_UNINSTALLABLE_MODULE := true
100
101include $(BUILD_DROIDDOC)
102car_system_stub_stamp := $(full_target)
103$(car_module_system_api_file) : $(full_target)
104
105#($(car_module_include_systemapi), true)
106endif
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -0800107
108
109ifneq ($(strip $(car_module_proguard_file)),)
110#
111# Generate a proguard files
112# ---------------------------------------------
113include $(CLEAR_VARS)
114
115LOCAL_MODULE := $(car_module)-proguard
116LOCAL_MODULE_CLASS := JAVA_LIBRARIES
117LOCAL_MODULE_TAGS := optional
118
119LOCAL_SRC_FILES := $(car_module_src_files)
120LOCAL_JAVA_LIBRARIES := $(car_module_java_libraries) $(car_module)
121LOCAL_ADDITIONAL_JAVA_DIR := \
122 $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(car_module),,COMMON)/src
123LOCAL_SDK_VERSION := $(CAR_CURRENT_SDK_VERSION)
124
125docs_proguard_intermediates_output := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),,COMMON)/keep_list.proguard
126LOCAL_DROIDDOC_OPTIONS := -proguard $(docs_proguard_intermediates_output)
127
128include $(BUILD_DROIDDOC)
129
130update-car-api: PRIVATE_PROGUARD_INTERMEDIATES_OUTPUT := $(docs_proguard_intermediates_output)
131update-car-api: PRIVATE_PROGUARD_OUTPUT_FILE := $(car_module_proguard_file)
132update-car-api: PRIVATE_CAR_MODULE := $(car_module)
133update-car-api: $(car_module)-proguard-docs | $(ACP)
134 @echo $(PRIVATE_CAR_MODULE) copying $(PRIVATE_PROGUARD_INTERMEDIATES_OUTPUT) to $(PRIVATE_PROGUARD_OUTPUT_FILE)
135 $(hide) $(ACP) $(PRIVATE_PROGUARD_INTERMEDIATES_OUTPUT) $(PRIVATE_PROGUARD_OUTPUT_FILE)
136
137# cleanup vars
138docs_proguard_output :=
139# ($(strip $(car_module_proguard_file)),)
140endif
141
142
Vitalii Tomkiv280b5722016-03-17 16:17:21 -0700143#
144# Check public API
145# ---------------------------------------------
146.PHONY: $(car_module)-check-public-api
147checkapi: $(car_module)-check-public-api
148$(car_module): $(car_module)-check-public-api
149
150last_released_sdk_$(car_module) := $(lastword $(call numerically_sort, \
151 $(filter-out current, \
152 $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/*.txt)) \
153 )))
154
155# Check that the API we're building hasn't broken the last-released SDK version
156# if it exists
157ifneq ($(last_released_sdk_$(car_module)),)
158$(eval $(call check-api, \
159 $(car_module)-checkapi-last, \
160 $(car_module_api_dir)/$(last_released_sdk_$(car_module)).txt, \
161 $(car_module_api_file), \
162 $(car_module_api_dir)/removed.txt, \
163 $(car_module_removed_file), \
164 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
165 -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \
166 -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \
167 cat $(api_check_last_msg_file), \
168 $(car_module)-check-public-api, \
169 $(car_stub_stamp)))
170endif
171
172# Check that the API we're building hasn't changed from the not-yet-released
173# SDK version.
174$(eval $(call check-api, \
175 $(car_module)-checkapi-current, \
176 $(car_module_api_dir)/current.txt, \
177 $(car_module_api_file), \
178 $(car_module_api_dir)/removed.txt, \
179 $(car_module_removed_file), \
180 -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \
181 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \
182 -error 21 -error 23 -error 24 -error 25 -hide 113, \
183 cat $(api_check_current_msg_file), \
184 $(car_module)-check-public-api, \
185 $(car_stub_stamp)))
186
187.PHONY: update-$(car_module)-api
188update-$(car_module)-api: PRIVATE_API_DIR := $(car_module_api_dir)
189update-$(car_module)-api: PRIVATE_MODULE := $(car_module)
190update-$(car_module)-api: PRIVATE_REMOVED_API_FILE := $(car_module_removed_file)
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -0800191update-$(car_module)-api: PRIVATE_PROGUARD_FILE := $(car_module_proguard_file)
Vitalii Tomkiv280b5722016-03-17 16:17:21 -0700192update-$(car_module)-api: $(car_module_api_file) | $(ACP)
193 @echo Copying $(PRIVATE_MODULE) current.txt
194 $(hide) $(ACP) $< $(PRIVATE_API_DIR)/current.txt
195 @echo Copying $(PRIVATE_MODULE) removed.txt
196 $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/removed.txt
197
198# Run this update API task on the update-car-api task
199update-car-api: update-$(car_module)-api
200
201ifeq ($(car_module_include_systemapi), true)
202
203#
204# Check system API
205# ---------------------------------------------
206.PHONY: $(car_module)-check-system-api
207checkapi: $(car_module)-check-system-api
208$(car_module): $(car_module)-check-system-api
209
210last_released_system_sdk_$(car_module) := $(lastword $(call numerically_sort, \
211 $(filter-out system-current, \
212 $(patsubst $(car_module_api_dir)/%.txt,%, $(wildcard $(car_module_api_dir)/system-*.txt)) \
213 )))
214
215# Check that the API we're building hasn't broken the last-released SDK version
216# if it exists
217ifneq ($(last_released_system_sdk_$(car_module)),)
218$(eval $(call check-api, \
219 $(car_module)-checksystemapi-last, \
220 $(car_module_api_dir)/$(last_released_system_sdk_$(car_module)).txt, \
221 $(car_module_system_api_file), \
222 $(car_module_api_dir)/system-removed.txt, \
223 $(car_module_system_removed_file), \
224 -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
225 -warning 7 -warning 8 -warning 9 -warning 10 -warning 11 -warning 12 \
226 -warning 13 -warning 14 -warning 15 -warning 16 -warning 17 -warning 18 -hide 113, \
227 cat $(api_check_last_msg_file), \
228 $(car_module)-check-system-api, \
229 $(car_system_stub_stamp)))
230endif
231
232# Check that the API we're building hasn't changed from the not-yet-released
233# SDK version.
234$(eval $(call check-api, \
235 $(car_module)-checksystemapi-current, \
236 $(car_module_api_dir)/system-current.txt, \
237 $(car_module_system_api_file), \
238 $(car_module_api_dir)/system-removed.txt, \
239 $(car_module_system_removed_file), \
240 -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \
241 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \
242 -error 21 -error 23 -error 24 -error 25 -hide 113, \
243 cat $(api_check_current_msg_file), \
244 $(car_module)-check-system-api, \
245 $(car_stub_stamp)))
246
247.PHONY: update-$(car_module)-system-api
248update-$(car_module)-system-api: PRIVATE_API_DIR := $(car_module_api_dir)
249update-$(car_module)-system-api: PRIVATE_MODULE := $(car_module)
250update-$(car_module)-system-api: PRIVATE_REMOVED_API_FILE := $(car_module_system_removed_file)
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -0800251update-$(car_module)-system-api: PRIVATE_PROGUARD_FILE := $(car_module_proguard_file)
Vitalii Tomkiv280b5722016-03-17 16:17:21 -0700252update-$(car_module)-system-api: $(car_module_system_api_file) | $(ACP)
253 @echo Copying $(PRIVATE_MODULE) system-current.txt
254 $(hide) $(ACP) $< $(PRIVATE_API_DIR)/system-current.txt
255 @echo Copying $(PRIVATE_MODULE) system-removed.txt
256 $(hide) $(ACP) $(PRIVATE_REMOVED_API_FILE) $(PRIVATE_API_DIR)/system-removed.txt
257
258# Run this update API task on the update-car-api task
259update-car-api: update-$(car_module)-system-api
260
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -0800261
262
Vitalii Tomkiv280b5722016-03-17 16:17:21 -0700263#($(car_module_include_systemapi), true)
264endif
265
266#($(TARGET_BUILD_PDK),true)
267endif
268
269#($(BOARD_IS_AUTOMOTIVE), true)
270endif
271#
272# Clear variables
273# ---------------------------------------------
274car_module :=
275car_module_api_dir :=
276car_module_src_files :=
277car_module_java_libraries :=
278car_module_java_packages :=
279car_module_api_file :=
280car_module_removed_file :=
281car_module_system_api_file :=
282car_module_system_removed__file :=
283car_stub_stamp :=
284car_system_stub_stamp :=
285car_module_include_systemapi :=
Jason Tholstrupa0b23ac2016-11-14 17:22:03 -0800286car_module_proguard_file :=