blob: 78f1b9ca26e520e9744de14a46d54f927015fd46 [file] [log] [blame]
Jiyong Park7fb4b182019-12-20 14:35:43 +09001// Copyright (C) 2019 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// How stubs are generated:
16//
17// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
18//
19// The metalava conversion is done by droidstub modules *-api-stubs-docs.
20// The javac compilation is done by java_library modules android_*_stubs_current.
21// The metalava conversion is also responsible for creating API signature files
22// and comparing them against the last API signature in api/*-current.txt files
23// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt
24// files.
25
26/////////////////////////////////////////////////////////////////////
27// Common metalava configs
28/////////////////////////////////////////////////////////////////////
29
30packages_to_document = [
31 "android",
32 "dalvik",
33 "java",
34 "javax",
35 "junit",
36 "org.apache.http",
37 "org.json",
38 "org.w3c.dom",
39 "org.xml.sax",
40 "org.xmlpull",
41]
42
43stubs_defaults {
44 name: "metalava-api-stubs-default",
45 srcs: [
46 ":framework-non-updatable-sources",
47 ":framework-updatable-sources",
48 "core/java/**/*.logtags",
49 ":opt-telephony-srcs",
50 ":opt-net-voip-srcs",
51 ":core-current-stubs-source",
52 ":core_public_api_files",
53 ":ike-api-srcs",
54 ],
55 libs: ["framework-internal-utils"],
56 installable: false,
57 annotations_enabled: true,
58 previous_api: ":last-released-public-api",
59 merge_annotations_dirs: [
60 "metalava-manual",
61 ],
62 api_levels_annotations_enabled: true,
63 api_levels_annotations_dirs: [
64 "sdk-dir",
65 "api-versions-jars-dir",
66 ],
67 sdk_version: "core_platform",
68 filter_packages: packages_to_document,
69}
70
71/////////////////////////////////////////////////////////////////////
72// *-api-stubs-docs modules providing source files for the stub libraries
73/////////////////////////////////////////////////////////////////////
74
75droidstubs {
76 name: "api-stubs-docs",
77 defaults: ["metalava-api-stubs-default"],
78 api_filename: "public_api.txt",
79 private_api_filename: "private.txt",
80 removed_api_filename: "removed.txt",
81 arg_files: [
82 "core/res/AndroidManifest.xml",
83 ],
84 args: metalava_framework_docs_args,
85 check_api: {
86 current: {
87 api_file: "api/current.txt",
88 removed_api_file: "api/removed.txt",
89 },
90 last_released: {
91 api_file: ":last-released-public-api",
92 removed_api_file: "api/removed.txt",
93 baseline_file: ":public-api-incompatibilities-with-last-released",
94 },
95 api_lint: {
96 enabled: true,
97 new_since: ":last-released-public-api",
98 baseline_file: "api/lint-baseline.txt",
99 },
100 },
101 jdiff_enabled: true,
102}
103
104droidstubs {
105 name: "system-api-stubs-docs",
106 defaults: ["metalava-api-stubs-default"],
107 api_tag_name: "SYSTEM",
108 api_filename: "system-api.txt",
109 private_api_filename: "system-private.txt",
110 private_dex_api_filename: "system-private-dex.txt",
111 removed_api_filename: "system-removed.txt",
112 arg_files: [
113 "core/res/AndroidManifest.xml",
114 ],
115 args: metalava_framework_docs_args + " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\)",
116 check_api: {
117 current: {
118 api_file: "api/system-current.txt",
119 removed_api_file: "api/system-removed.txt",
120 },
121 last_released: {
122 api_file: ":last-released-system-api",
123 removed_api_file: "api/system-removed.txt",
124 baseline_file: ":system-api-incompatibilities-with-last-released"
125 },
126 api_lint: {
127 enabled: true,
128 new_since: ":last-released-system-api",
129 baseline_file: "api/system-lint-baseline.txt",
130 },
131 },
132 jdiff_enabled: true,
133}
134
135droidstubs {
136 name: "test-api-stubs-docs",
137 defaults: ["metalava-api-stubs-default"],
138 api_tag_name: "TEST",
139 api_filename: "test-api.txt",
140 removed_api_filename: "test-removed.txt",
141 arg_files: [
142 "core/res/AndroidManifest.xml",
143 ],
144 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
145 check_api: {
146 current: {
147 api_file: "api/test-current.txt",
148 removed_api_file: "api/test-removed.txt",
149 },
150 api_lint: {
151 enabled: true,
152 baseline_file: "api/test-lint-baseline.txt",
153 },
154 },
155}
156
157/////////////////////////////////////////////////////////////////////
158// android_*_stubs_current modules are the stubs libraries compiled
159// from *-api-stubs-docs
160/////////////////////////////////////////////////////////////////////
161
162java_defaults {
163 name: "framework-stubs-default",
164 errorprone: {
165 javacflags: [
166 "-XepDisableAllChecks",
167 ],
168 },
169 java_resources: [
170 ":notices-for-framework-stubs",
171 ],
172 sdk_version: "core_current",
173 system_modules: "none",
174 java_version: "1.8",
175 compile_dex: true,
176}
177
178java_library_static {
179 name: "android_stubs_current",
180 srcs: [
181 ":api-stubs-docs",
182 ],
183 libs: [
184 "stub-annotations",
185 ],
186 static_libs: [
187 "private-stub-annotations-jar",
188 ],
189 defaults: ["framework-stubs-default"],
190}
191
192java_library_static {
193 name: "android_system_stubs_current",
194 srcs: [
195 ":system-api-stubs-docs",
196 ],
197 libs: [
198 "stub-annotations",
199 ],
200 static_libs: [
201 "private-stub-annotations-jar",
202 ],
203 defaults: ["framework-stubs-default"],
204}
205
206java_library_static {
207 name: "android_test_stubs_current",
208 srcs: [
209 ":test-api-stubs-docs",
210 ],
211 libs: [
212 "stub-annotations",
213 ],
214 static_libs: [
215 "private-stub-annotations-jar",
216 ],
217 defaults: ["framework-stubs-default"],
218}
219
220java_system_modules {
221 name: "android_stubs_current_system_modules",
222 libs: ["android_stubs_current"],
223}
224
225java_system_modules {
226 name: "android_system_stubs_current_system_modules",
227 libs: ["android_system_stubs_current"],
228}
229
230java_system_modules {
231 name: "android_test_stubs_current_system_modules",
232 libs: ["android_test_stubs_current"],
233}
234
235/////////////////////////////////////////////////////////////////////
236// hwbinder.stubs provides APIs required for building HIDL Java
237// libraries.
238/////////////////////////////////////////////////////////////////////
239
240droidstubs {
241 name: "hwbinder-stubs-docs",
242 srcs: [
243 "core/java/android/os/HidlSupport.java",
244 "core/java/android/annotation/IntDef.java",
245 "core/java/android/annotation/IntRange.java",
246 "core/java/android/annotation/NonNull.java",
247 "core/java/android/annotation/SystemApi.java",
248 "core/java/android/os/HidlMemory.java",
249 "core/java/android/os/HwBinder.java",
250 "core/java/android/os/HwBlob.java",
251 "core/java/android/os/HwParcel.java",
252 "core/java/android/os/IHwBinder.java",
253 "core/java/android/os/IHwInterface.java",
254 "core/java/android/os/DeadObjectException.java",
255 "core/java/android/os/DeadSystemException.java",
256 "core/java/android/os/NativeHandle.java",
257 "core/java/android/os/RemoteException.java",
258 "core/java/android/util/AndroidException.java",
259 ],
260 installable: false,
261 sdk_version: "core_platform",
262 annotations_enabled: true,
263 previous_api: ":last-released-public-api",
264 merge_annotations_dirs: [
265 "metalava-manual",
266 ],
267 args: " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\)",
268}
269
270java_library_static {
271 name: "hwbinder.stubs",
272 sdk_version: "core_current",
273 srcs: [
274 ":hwbinder-stubs-docs",
275 ],
276}
277
278/////////////////////////////////////////////////////////////////////
279// Stubs for hiddenapi processing.
280/////////////////////////////////////////////////////////////////////
281
282droidstubs {
283 name: "hiddenapi-lists-docs",
284 defaults: ["metalava-api-stubs-default"],
285 arg_files: [
286 "core/res/AndroidManifest.xml",
287 ],
288 dex_api_filename: "public-dex.txt",
289 private_dex_api_filename: "private-dex.txt",
290 removed_dex_api_filename: "removed-dex.txt",
291 args: metalava_framework_docs_args +
292 " --show-unannotated " +
293 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " +
294 " --show-annotation android.annotation.TestApi ",
295}
296
297droidstubs {
298 name: "hiddenapi-mappings",
299 defaults: ["metalava-api-stubs-default"],
300 srcs: [
301 ":opt-telephony-common-srcs",
302 ],
303
304 arg_files: [
305 "core/res/AndroidManifest.xml",
306 ],
307 dex_mapping_filename: "dex-mapping.txt",
308 args: metalava_framework_docs_args +
309 " --hide ReferencesHidden " +
310 " --hide UnhiddenSystemApi " +
311 " --show-unannotated " +
312 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " +
313 " --show-annotation android.annotation.TestApi ",
314}
315
316/////////////////////////////////////////////////////////////////////
317// api/*-current.txt files for use by modules in other directories
318// like the CTS test
319/////////////////////////////////////////////////////////////////////
320
321filegroup {
322 name: "frameworks-base-api-current.txt",
323 srcs: [
324 "api/current.txt",
325 ],
326}
327
328filegroup {
329 name: "frameworks-base-api-system-current.txt",
330 srcs: [
331 "api/system-current.txt",
332 ],
333}
334
335filegroup {
336 name: "frameworks-base-api-system-removed.txt",
337 srcs: [
338 "api/system-removed.txt",
339 ],
340}