blob: 4bba338acf3f8aa4d37101cff13ddbef811f0b20 [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 API docs are generated:
16//
17// raw source files --(metalava)--> stub source files --(doclava)--> API doc
18//
19// The metalava conversion is done by droidstub modules framework-doc-*-stubs.
20// The API doc generation is done by the various droiddoc modules each of which
21// is for different format.
22
23/////////////////////////////////////////////////////////////////////
24// stub source files are generated using metalava
25/////////////////////////////////////////////////////////////////////
26
27framework_docs_only_libs = [
28 "voip-common",
29 "android.test.mock",
30 "android-support-annotations",
31 "android-support-compat",
32 "android-support-core-ui",
33 "android-support-core-utils",
34 "android-support-design",
35 "android-support-dynamic-animation",
36 "android-support-exifinterface",
37 "android-support-fragment",
38 "android-support-media-compat",
39 "android-support-percent",
40 "android-support-transition",
41 "android-support-v7-cardview",
42 "android-support-v7-gridlayout",
43 "android-support-v7-mediarouter",
44 "android-support-v7-palette",
45 "android-support-v7-preference",
46 "android-support-v13",
47 "android-support-v14-preference",
48 "android-support-v17-leanback",
49 "android-support-vectordrawable",
50 "android-support-animatedvectordrawable",
51 "android-support-v7-appcompat",
52 "android-support-v7-recyclerview",
53 "android-support-v8-renderscript",
54 "android-support-multidex",
55 "android-support-multidex-instrumentation",
56]
57
Anton Hansson5aa59332022-01-21 16:32:31 +000058// These defaults enable doc-stub generation, api lint database generation and sdk value generation.
Jiyong Park7fb4b182019-12-20 14:35:43 +090059stubs_defaults {
Anton Hansson867f94c2021-05-05 10:32:31 +010060 name: "android-non-updatable-doc-stubs-defaults",
Anton Hansson87f04b82022-01-17 19:27:06 +000061 defaults: ["android-non-updatable-stubs-defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090062 srcs: [
Anton Hansson35c0b092021-03-30 10:46:48 +010063 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010064 ":android-test-base-sources",
65 ":android-test-mock-sources",
66 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090067 ],
68 libs: framework_docs_only_libs,
69 create_doc_stubs: true,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010070 write_sdk_values: true,
Jiyong Park7fb4b182019-12-20 14:35:43 +090071}
72
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010073// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010074stubs_defaults {
75 name: "framework-doc-stubs-sources-default",
Anton Hansson5aa59332022-01-21 16:32:31 +000076 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010077 srcs: [
Anton Hanssonecf9fc32022-01-14 12:10:01 +000078 ":art.module.public.api{.public.stubs.source}",
79 ":conscrypt.module.public.api{.public.stubs.source}",
80 ":i18n.module.public.api{.public.stubs.source}",
81
Neha Pattanfa46dd22022-02-18 19:46:09 +000082 ":framework-adservices-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010083 ":framework-appsearch-sources",
84 ":framework-connectivity-sources",
Roopa Sattiraju8e305772022-01-20 10:05:19 -080085 ":framework-bluetooth-sources",
paulhuf45fe962021-12-14 23:09:55 +080086 ":framework-connectivity-tiramisu-updatable-sources",
qiaoli8d1d87d2022-09-28 16:21:05 +000087 ":framework-federatedcompute-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010088 ":framework-graphics-srcs",
89 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -070090 ":framework-nearby-sources",
Frank Wange97ff9e2022-02-13 07:06:31 +000091 ":framework-ondevicepersonalization-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010092 ":framework-permission-sources",
93 ":framework-permission-s-sources",
94 ":framework-scheduling-sources",
95 ":framework-sdkextensions-sources",
96 ":framework-statsd-sources",
Nikita Ioffe59029ad2022-02-24 01:56:44 +000097 ":framework-sdksandbox-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010098 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -070099 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100100 ":framework-wifi-updatable-sources",
101 ":ike-srcs",
102 ":updatable-media-srcs",
103 ],
104}
105
Jiyong Park7fb4b182019-12-20 14:35:43 +0900106droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100107 name: "android-non-updatable-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000108 defaults: [
109 "android-non-updatable-doc-stubs-defaults",
110 "module-classpath-stubs-defaults",
111 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100112 args: metalava_framework_docs_args,
113}
114
115droidstubs {
116 name: "android-non-updatable-doc-stubs-system",
Anton Hansson5aa59332022-01-21 16:32:31 +0000117 defaults: [
118 "android-non-updatable-doc-stubs-defaults",
119 "module-classpath-stubs-defaults",
120 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100121 args: metalava_framework_docs_args +
122 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
123}
124
125droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900126 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100127 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000128 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000129 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Anton Hansson5aa59332022-01-21 16:32:31 +0000130 api_levels_annotations_enabled: true,
131 api_levels_annotations_dirs: [
132 "sdk-dir",
133 "api-versions-jars-dir",
134 ],
satayevbc7c83e2021-06-29 22:27:06 +0100135 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200136 extensions_info_file: ":sdk-extensions-info",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900137}
138
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100139droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000140 name: "framework-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000141 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonecf9fc32022-01-14 12:10:01 +0000142 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100143 args: metalava_framework_docs_args,
Anton Hansson247c5f22022-05-09 09:53:12 +0000144 api_levels_module: "api_versions_public",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100145 aidl: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100146 include_dirs: [
147 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddinb8b46fd2022-02-11 14:20:10 +0000148 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100149 ],
150 },
Mårten Kongstad54845332022-09-06 15:50:37 +0200151 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100152}
153
Jiyong Park7fb4b182019-12-20 14:35:43 +0900154/////////////////////////////////////////////////////////////////////
155// API docs are created from the generated stub source files
156// using droiddoc
157/////////////////////////////////////////////////////////////////////
158
159framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
160 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
161 "-overview $(location core/java/overview.html) " +
162 // Federate Support Library references against local API file.
163 "-federate SupportLib https://developer.android.com " +
164 "-federationapi SupportLib $(location :current-support-api) " +
165 // Federate Support Library references against local API file.
166 "-federate AndroidX https://developer.android.com " +
167 "-federationapi AndroidX $(location :current-androidx-api) "
168
169doc_defaults {
170 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000171 libs: framework_docs_only_libs + [
172 "stub-annotations",
173 "unsupportedappusage",
174 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900175 html_dirs: [
176 "docs/html",
177 ],
178 knowntags: [
179 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100180 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900181 ],
182 custom_template: "droiddoc-templates-sdk",
183 resourcesdir: "docs/html/reference/images/",
184 resourcesoutdir: "reference/android/images/",
185 hdf: [
186 "dac true",
187 "sdk.codename O",
188 "sdk.preview.version 1",
189 "sdk.version 7.0",
190 "sdk.rel.id 1",
191 "sdk.preview 0",
192 ],
193 arg_files: [
194 "core/res/AndroidManifest.xml",
195 "core/java/overview.html",
196 ":current-support-api",
197 ":current-androidx-api",
198 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700199 // TODO(b/169090544): remove below aidl includes.
200 aidl: {
201 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600202 include_dirs: [
203 "frameworks/av/aidl",
204 "frameworks/native/libs/permission/aidl",
205 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700206 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900207}
208
209doc_defaults {
210 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900211}
212
213droiddoc {
214 name: "doc-comment-check-docs",
215 defaults: ["framework-docs-default"],
216 srcs: [
217 ":framework-doc-stubs",
218 ],
219 args: framework_docs_only_args + " -referenceonly -parsecomments",
220 installable: false,
221}
222
223droiddoc {
224 name: "offline-sdk-docs",
225 defaults: ["framework-docs-default"],
226 srcs: [
227 ":framework-doc-stubs",
228 ],
229 hdf: [
230 "android.whichdoc offline",
231 ],
atrostb1ee27b2020-02-03 11:03:16 +0000232 compat_config: ":global-compat-config",
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000233 proofread_file: "offline-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900234 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
235 static_doc_index_redirect: "docs/docs-preview-index.html",
236}
237
238droiddoc {
239 // Please sync with android-api-council@ before making any changes for the name property below.
240 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
241 // See b/116221385 for reference.
242 name: "offline-sdk-referenceonly-docs",
243 defaults: ["framework-docs-default"],
244 srcs: [
245 ":framework-doc-stubs",
246 ],
247 hdf: [
248 "android.whichdoc offline",
249 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000250 proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900251 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
252 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
253 static_doc_properties: "docs/source.properties",
254}
255
256droiddoc {
257 // Please sync with android-api-council@ before making any changes for the name property below.
258 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
259 // See b/116221385 for reference.
260 name: "offline-system-sdk-referenceonly-docs",
261 defaults: ["framework-docs-default"],
262 srcs: [
263 ":framework-doc-system-stubs",
264 ],
265 hdf: [
266 "android.whichdoc offline",
267 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000268 proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900269 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
270 " -offlinemode -title \"Android System SDK\" -referenceonly",
271 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
272 static_doc_properties: "docs/source.properties",
273}
274
275droiddoc {
276 name: "online-sdk-docs",
277 defaults: ["framework-docs-default"],
278 srcs: [
279 ":framework-doc-stubs",
280 ],
281 hdf: [
282 "android.whichdoc online",
283 "android.hasSamples true",
284 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000285 proofread_file: "online-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900286 args: framework_docs_only_args +
287 " -toroot / -samplegroup Admin " +
288 " -samplegroup Background " +
289 " -samplegroup Connectivity " +
290 " -samplegroup Content " +
291 " -samplegroup Input " +
292 " -samplegroup Media " +
293 " -samplegroup Notification " +
294 " -samplegroup RenderScript " +
295 " -samplegroup Security " +
296 " -samplegroup Sensors " +
297 " -samplegroup System " +
298 " -samplegroup Testing " +
299 " -samplegroup UI " +
300 " -samplegroup Views " +
301 " -samplegroup Wearable -samplesdir development/samples/browseable ",
302}
303
304droiddoc {
305 name: "online-system-api-sdk-docs",
306 defaults: ["framework-docs-default"],
307 srcs: [
308 ":framework-doc-system-stubs",
309 ],
310 hdf: [
311 "android.whichdoc online",
312 "android.hasSamples true",
313 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000314 proofread_file: "online-system-api-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900315 args: framework_docs_only_args +
316 " -referenceonly " +
317 " -title \"Android SDK - Including system APIs.\" " +
318 " -hide 101 " +
319 " -hide 104 " +
320 " -hide 108 " +
321 " -toroot / -samplegroup Admin " +
322 " -samplegroup Background " +
323 " -samplegroup Connectivity " +
324 " -samplegroup Content " +
325 " -samplegroup Input " +
326 " -samplegroup Media " +
327 " -samplegroup Notification " +
328 " -samplegroup RenderScript " +
329 " -samplegroup Security " +
330 " -samplegroup Sensors " +
331 " -samplegroup System " +
332 " -samplegroup Testing " +
333 " -samplegroup UI " +
334 " -samplegroup Views " +
335 " -samplegroup Wearable -samplesdir development/samples/browseable ",
336 installable: false,
337}
338
339droiddoc {
340 name: "ds-docs-java",
341 defaults: ["framework-docs-default"],
342 srcs: [
343 ":framework-doc-stubs",
344 ],
345 hdf: [
346 "android.whichdoc online",
347 "android.hasSamples true",
348 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000349 proofread_file: "ds-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900350 args: framework_docs_only_args +
351 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
352 " -samplegroup Background " +
353 " -samplegroup Connectivity " +
354 " -samplegroup Content " +
355 " -samplegroup Input " +
356 " -samplegroup Media " +
357 " -samplegroup Notification " +
358 " -samplegroup RenderScript " +
359 " -samplegroup Security " +
360 " -samplegroup Sensors " +
361 " -samplegroup System " +
362 " -samplegroup Testing " +
363 " -samplegroup UI " +
364 " -samplegroup Views " +
365 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
366}
367
368droiddoc {
369 name: "ds-docs-kt",
370 defaults: ["framework-dokka-docs-default"],
371 srcs: [
372 ":framework-doc-stubs",
373 ],
374 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700375 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900376 proofread_file: "ds-dokka-proofread.txt",
377 dokka_enabled: true,
378}
379
380java_genrule {
381 name: "ds-docs",
382 tools: [
383 "zip2zip",
384 "merge_zips",
385 ],
386 srcs: [
387 ":ds-docs-java{.docs.zip}",
388 ":ds-docs-kt{.docs.zip}",
389 ],
390 out: ["ds-docs.zip"],
391 dist: {
392 targets: ["docs"],
393 },
394 cmd: "$(location zip2zip) -i $(location :ds-docs-kt{.docs.zip}) -o $(genDir)/ds-docs-kt-moved.zip **/*:en/reference/kotlin && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700395 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900396}
397
398java_genrule {
399 name: "ds-docs-switched",
400 tools: [
401 "switcher4",
402 "soong_zip",
403 ],
404 srcs: [
405 ":ds-docs-java{.docs.zip}",
406 ":ds-docs-kt{.docs.zip}",
407 ],
408 out: ["ds-docs-switched.zip"],
409 dist: {
410 targets: ["docs"],
411 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800412 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700413 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
414 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
415 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
416 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900417}
418
419droiddoc {
420 name: "ds-static-docs",
421 defaults: ["framework-docs-default"],
422 srcs: [
423 ":framework-doc-stubs",
424 ],
425 hdf: [
426 "android.whichdoc online",
427 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900428 args: framework_docs_only_args +
429 " -staticonly " +
430 " -toroot / " +
431 " -devsite " +
432 " -ignoreJdLinks ",
433}
434
435droiddoc {
436 name: "ds-ref-navtree-docs",
437 defaults: ["framework-docs-default"],
438 srcs: [
439 ":framework-doc-stubs",
440 ],
441 hdf: [
442 "android.whichdoc online",
443 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900444 args: framework_docs_only_args +
445 " -toroot / " +
446 " -atLinksNavtree " +
447 " -navtreeonly ",
448}
449
450droiddoc {
451 name: "online-sdk-dev-docs",
452 defaults: ["framework-docs-default"],
453 srcs: [
454 ":framework-doc-stubs",
455 ],
456 hdf: [
457 "android.whichdoc online",
458 "android.hasSamples true",
459 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000460 proofread_file: "online-sdk-dev-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900461 args: framework_docs_only_args +
462 " -toroot / -samplegroup Admin " +
463 " -samplegroup Background " +
464 " -samplegroup Connectivity " +
465 " -samplegroup Content " +
466 " -samplegroup Input " +
467 " -samplegroup Media " +
468 " -samplegroup Notification " +
469 " -samplegroup RenderScript " +
470 " -samplegroup Security " +
471 " -samplegroup Sensors " +
472 " -samplegroup System " +
473 " -samplegroup Testing " +
474 " -samplegroup UI " +
475 " -samplegroup Views " +
476 " -samplegroup Wearable -samplesdir development/samples/browseable ",
477}
478
479droiddoc {
480 name: "hidden-docs",
481 defaults: ["framework-docs-default"],
482 srcs: [
483 ":framework-doc-stubs",
484 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000485 proofread_file: "hidden-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900486 args: framework_docs_only_args +
487 " -referenceonly " +
488 " -title \"Android SDK - Including hidden APIs.\"",
489}