blob: 82759f767c3e9747877f1f5c50eda9f6c731301c [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
58stubs_defaults {
Anton Hansson867f94c2021-05-05 10:32:31 +010059 name: "android-non-updatable-doc-stubs-defaults",
60 defaults: ["android-non-updatable-stubs-defaults"],
61 srcs: [
62 // No longer part of the stubs, but are included in the docs.
63 "test-base/src/**/*.java",
64 "test-mock/src/**/*.java",
65 "test-runner/src/**/*.java",
66 ],
67 libs: framework_docs_only_libs,
68 create_doc_stubs: true,
69 write_sdk_values: true,
70}
71
72stubs_defaults {
Jiyong Park7fb4b182019-12-20 14:35:43 +090073 name: "framework-doc-stubs-default",
74 srcs: [
Anton Hansson867f94c2021-05-05 10:32:31 +010075 ":android-non-updatable-stub-sources",
Anton Hansson35c0b092021-03-30 10:46:48 +010076
77 // Module sources
Paul Duffin404b26a2020-09-16 14:26:47 +010078 ":art.module.public.api{.public.stubs.source}",
Paul Duffine55d4e32020-05-14 17:55:46 +010079 ":conscrypt.module.public.api{.public.stubs.source}",
Paul Duffin5a4e8f22020-11-25 15:45:43 +000080 ":i18n.module.public.api{.public.stubs.source}",
Anton Hansson35c0b092021-03-30 10:46:48 +010081
82 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010083 ":android-test-base-sources",
84 ":android-test-mock-sources",
85 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090086 ],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010087 arg_files: [
88 "core/res/AndroidManifest.xml",
89 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090090 libs: framework_docs_only_libs,
91 create_doc_stubs: true,
92 annotations_enabled: true,
Anton Hansson76ac4cc2021-05-05 19:22:52 +010093 filter_packages: packages_to_document,
Jiyong Park7fb4b182019-12-20 14:35:43 +090094 api_levels_annotations_enabled: true,
95 api_levels_annotations_dirs: [
96 "sdk-dir",
97 "api-versions-jars-dir",
98 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +010099 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900100 merge_annotations_dirs: [
101 "metalava-manual",
102 ],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100103 write_sdk_values: true,
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700104 // TODO(b/169090544): remove below aidl includes.
105 aidl: {
106 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600107 include_dirs: [
108 "frameworks/av/aidl",
109 "frameworks/native/libs/permission/aidl",
110 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700111 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900112}
113
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100114// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100115stubs_defaults {
116 name: "framework-doc-stubs-sources-default",
117 defaults: ["framework-doc-stubs-default"],
118 srcs: [
119 ":framework-appsearch-sources",
120 ":framework-connectivity-sources",
121 ":framework-graphics-srcs",
122 ":framework-mediaprovider-sources",
123 ":framework-permission-sources",
124 ":framework-permission-s-sources",
125 ":framework-scheduling-sources",
126 ":framework-sdkextensions-sources",
127 ":framework-statsd-sources",
128 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700129 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100130 ":framework-wifi-updatable-sources",
131 ":ike-srcs",
132 ":updatable-media-srcs",
133 ],
134}
135
Jiyong Park7fb4b182019-12-20 14:35:43 +0900136droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100137 name: "android-non-updatable-doc-stubs",
138 defaults: ["android-non-updatable-doc-stubs-defaults"],
139 args: metalava_framework_docs_args,
140}
141
142droidstubs {
143 name: "android-non-updatable-doc-stubs-system",
144 defaults: ["android-non-updatable-doc-stubs-defaults"],
145 args: metalava_framework_docs_args +
146 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
147}
148
149droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900150 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100151 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000152 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000153 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100154 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900155}
156
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100157droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000158 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100159 defaults: ["framework-doc-stubs-default"],
160 args: metalava_framework_docs_args,
161 srcs: [
162 ":android.net.ipsec.ike{.public.stubs.source}",
163 ":framework-appsearch{.public.stubs.source}",
164 ":framework-connectivity{.public.stubs.source}",
165 ":framework-graphics{.public.stubs.source}",
166 ":framework-media{.public.stubs.source}",
167 ":framework-mediaprovider{.public.stubs.source}",
168 ":framework-permission{.public.stubs.source}",
169 ":framework-permission-s{.public.stubs.source}",
170 ":framework-scheduling{.public.stubs.source}",
171 ":framework-sdkextensions{.public.stubs.source}",
172 ":framework-statsd{.public.stubs.source}",
173 ":framework-tethering{.public.stubs.source}",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700174 ":framework-uwb{.public.stubs.source}",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100175 ":framework-wifi{.public.stubs.source}",
176 ],
177 aidl: {
178 local_include_dirs: [
179 "apex/media/aidl/stable",
180 ],
181 include_dirs: [
182 "packages/modules/Connectivity/framework/aidl-export",
183 ],
184 },
185}
186
Anton Hansson1bf568e2021-09-24 13:16:19 +0100187// This produces the same annotations.zip as framework-doc-stubs, but by using
188// outputs from individual modules instead of all the source code.
189genrule {
190 name: "sdk-annotations.zip",
191 srcs: [
192 ":android-non-updatable-doc-stubs{.annotations.zip}",
193
194 // Conscrypt and i18n currently do not enable annotations
195 // ":conscrypt.module.public.api{.public.annotations.zip}",
196 // ":i18n.module.public.api{.public.annotations.zip}",
197
198 // Modules that enable annotations below
199 ":android.net.ipsec.ike{.public.annotations.zip}",
200 ":art.module.public.api{.public.annotations.zip}",
201 ":framework-appsearch{.public.annotations.zip}",
202 ":framework-connectivity{.public.annotations.zip}",
203 ":framework-graphics{.public.annotations.zip}",
204 ":framework-media{.public.annotations.zip}",
205 ":framework-mediaprovider{.public.annotations.zip}",
206 ":framework-permission{.public.annotations.zip}",
207 ":framework-permission-s{.public.annotations.zip}",
208 ":framework-scheduling{.public.annotations.zip}",
209 ":framework-sdkextensions{.public.annotations.zip}",
210 ":framework-statsd{.public.annotations.zip}",
211 ":framework-tethering{.public.annotations.zip}",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700212 ":framework-uwb{.public.annotations.zip}",
Anton Hansson1bf568e2021-09-24 13:16:19 +0100213 ":framework-wifi{.public.annotations.zip}",
214 ],
215 out: ["annotations.zip"],
216 tools: [
217 "merge_annotation_zips",
218 "soong_zip",
219 ],
220 cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
221 "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
222}
223
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224/////////////////////////////////////////////////////////////////////
225// API docs are created from the generated stub source files
226// using droiddoc
227/////////////////////////////////////////////////////////////////////
228
229framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
230 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
231 "-overview $(location core/java/overview.html) " +
232 // Federate Support Library references against local API file.
233 "-federate SupportLib https://developer.android.com " +
234 "-federationapi SupportLib $(location :current-support-api) " +
235 // Federate Support Library references against local API file.
236 "-federate AndroidX https://developer.android.com " +
237 "-federationapi AndroidX $(location :current-androidx-api) "
238
239doc_defaults {
240 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000241 libs: framework_docs_only_libs + [
242 "stub-annotations",
243 "unsupportedappusage",
244 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900245 html_dirs: [
246 "docs/html",
247 ],
248 knowntags: [
249 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100250 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900251 ],
252 custom_template: "droiddoc-templates-sdk",
253 resourcesdir: "docs/html/reference/images/",
254 resourcesoutdir: "reference/android/images/",
255 hdf: [
256 "dac true",
257 "sdk.codename O",
258 "sdk.preview.version 1",
259 "sdk.version 7.0",
260 "sdk.rel.id 1",
261 "sdk.preview 0",
262 ],
263 arg_files: [
264 "core/res/AndroidManifest.xml",
265 "core/java/overview.html",
266 ":current-support-api",
267 ":current-androidx-api",
268 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700269 // TODO(b/169090544): remove below aidl includes.
270 aidl: {
271 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600272 include_dirs: [
273 "frameworks/av/aidl",
274 "frameworks/native/libs/permission/aidl",
275 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700276 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900277}
278
279doc_defaults {
280 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900281}
282
283droiddoc {
284 name: "doc-comment-check-docs",
285 defaults: ["framework-docs-default"],
286 srcs: [
287 ":framework-doc-stubs",
288 ],
289 args: framework_docs_only_args + " -referenceonly -parsecomments",
290 installable: false,
291}
292
293droiddoc {
294 name: "offline-sdk-docs",
295 defaults: ["framework-docs-default"],
296 srcs: [
297 ":framework-doc-stubs",
298 ],
299 hdf: [
300 "android.whichdoc offline",
301 ],
atrostb1ee27b2020-02-03 11:03:16 +0000302 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900303 proofread_file: "offline-sdk-docs-proofrerad.txt",
304 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
305 static_doc_index_redirect: "docs/docs-preview-index.html",
306}
307
308droiddoc {
309 // Please sync with android-api-council@ before making any changes for the name property below.
310 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
311 // See b/116221385 for reference.
312 name: "offline-sdk-referenceonly-docs",
313 defaults: ["framework-docs-default"],
314 srcs: [
315 ":framework-doc-stubs",
316 ],
317 hdf: [
318 "android.whichdoc offline",
319 ],
320 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
321 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
322 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
323 static_doc_properties: "docs/source.properties",
324}
325
326droiddoc {
327 // Please sync with android-api-council@ before making any changes for the name property below.
328 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
329 // See b/116221385 for reference.
330 name: "offline-system-sdk-referenceonly-docs",
331 defaults: ["framework-docs-default"],
332 srcs: [
333 ":framework-doc-system-stubs",
334 ],
335 hdf: [
336 "android.whichdoc offline",
337 ],
338 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
339 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
340 " -offlinemode -title \"Android System SDK\" -referenceonly",
341 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
342 static_doc_properties: "docs/source.properties",
343}
344
345droiddoc {
346 name: "online-sdk-docs",
347 defaults: ["framework-docs-default"],
348 srcs: [
349 ":framework-doc-stubs",
350 ],
351 hdf: [
352 "android.whichdoc online",
353 "android.hasSamples true",
354 ],
355 proofread_file: "online-sdk-docs-proofrerad.txt",
356 args: framework_docs_only_args +
357 " -toroot / -samplegroup Admin " +
358 " -samplegroup Background " +
359 " -samplegroup Connectivity " +
360 " -samplegroup Content " +
361 " -samplegroup Input " +
362 " -samplegroup Media " +
363 " -samplegroup Notification " +
364 " -samplegroup RenderScript " +
365 " -samplegroup Security " +
366 " -samplegroup Sensors " +
367 " -samplegroup System " +
368 " -samplegroup Testing " +
369 " -samplegroup UI " +
370 " -samplegroup Views " +
371 " -samplegroup Wearable -samplesdir development/samples/browseable ",
372}
373
374droiddoc {
375 name: "online-system-api-sdk-docs",
376 defaults: ["framework-docs-default"],
377 srcs: [
378 ":framework-doc-system-stubs",
379 ],
380 hdf: [
381 "android.whichdoc online",
382 "android.hasSamples true",
383 ],
384 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
385 args: framework_docs_only_args +
386 " -referenceonly " +
387 " -title \"Android SDK - Including system APIs.\" " +
388 " -hide 101 " +
389 " -hide 104 " +
390 " -hide 108 " +
391 " -toroot / -samplegroup Admin " +
392 " -samplegroup Background " +
393 " -samplegroup Connectivity " +
394 " -samplegroup Content " +
395 " -samplegroup Input " +
396 " -samplegroup Media " +
397 " -samplegroup Notification " +
398 " -samplegroup RenderScript " +
399 " -samplegroup Security " +
400 " -samplegroup Sensors " +
401 " -samplegroup System " +
402 " -samplegroup Testing " +
403 " -samplegroup UI " +
404 " -samplegroup Views " +
405 " -samplegroup Wearable -samplesdir development/samples/browseable ",
406 installable: false,
407}
408
409droiddoc {
410 name: "ds-docs-java",
411 defaults: ["framework-docs-default"],
412 srcs: [
413 ":framework-doc-stubs",
414 ],
415 hdf: [
416 "android.whichdoc online",
417 "android.hasSamples true",
418 ],
419 proofread_file: "ds-docs-proofrerad.txt",
420 args: framework_docs_only_args +
421 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
422 " -samplegroup Background " +
423 " -samplegroup Connectivity " +
424 " -samplegroup Content " +
425 " -samplegroup Input " +
426 " -samplegroup Media " +
427 " -samplegroup Notification " +
428 " -samplegroup RenderScript " +
429 " -samplegroup Security " +
430 " -samplegroup Sensors " +
431 " -samplegroup System " +
432 " -samplegroup Testing " +
433 " -samplegroup UI " +
434 " -samplegroup Views " +
435 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
436}
437
438droiddoc {
439 name: "ds-docs-kt",
440 defaults: ["framework-dokka-docs-default"],
441 srcs: [
442 ":framework-doc-stubs",
443 ],
444 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700445 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900446 proofread_file: "ds-dokka-proofread.txt",
447 dokka_enabled: true,
448}
449
450java_genrule {
451 name: "ds-docs",
452 tools: [
453 "zip2zip",
454 "merge_zips",
455 ],
456 srcs: [
457 ":ds-docs-java{.docs.zip}",
458 ":ds-docs-kt{.docs.zip}",
459 ],
460 out: ["ds-docs.zip"],
461 dist: {
462 targets: ["docs"],
463 },
464 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 -0700465 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900466}
467
468java_genrule {
469 name: "ds-docs-switched",
470 tools: [
471 "switcher4",
472 "soong_zip",
473 ],
474 srcs: [
475 ":ds-docs-java{.docs.zip}",
476 ":ds-docs-kt{.docs.zip}",
477 ],
478 out: ["ds-docs-switched.zip"],
479 dist: {
480 targets: ["docs"],
481 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800482 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700483 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
484 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
485 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
486 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900487}
488
489droiddoc {
490 name: "ds-static-docs",
491 defaults: ["framework-docs-default"],
492 srcs: [
493 ":framework-doc-stubs",
494 ],
495 hdf: [
496 "android.whichdoc online",
497 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900498 args: framework_docs_only_args +
499 " -staticonly " +
500 " -toroot / " +
501 " -devsite " +
502 " -ignoreJdLinks ",
503}
504
505droiddoc {
506 name: "ds-ref-navtree-docs",
507 defaults: ["framework-docs-default"],
508 srcs: [
509 ":framework-doc-stubs",
510 ],
511 hdf: [
512 "android.whichdoc online",
513 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900514 args: framework_docs_only_args +
515 " -toroot / " +
516 " -atLinksNavtree " +
517 " -navtreeonly ",
518}
519
520droiddoc {
521 name: "online-sdk-dev-docs",
522 defaults: ["framework-docs-default"],
523 srcs: [
524 ":framework-doc-stubs",
525 ],
526 hdf: [
527 "android.whichdoc online",
528 "android.hasSamples true",
529 ],
530 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
531 args: framework_docs_only_args +
532 " -toroot / -samplegroup Admin " +
533 " -samplegroup Background " +
534 " -samplegroup Connectivity " +
535 " -samplegroup Content " +
536 " -samplegroup Input " +
537 " -samplegroup Media " +
538 " -samplegroup Notification " +
539 " -samplegroup RenderScript " +
540 " -samplegroup Security " +
541 " -samplegroup Sensors " +
542 " -samplegroup System " +
543 " -samplegroup Testing " +
544 " -samplegroup UI " +
545 " -samplegroup Views " +
546 " -samplegroup Wearable -samplesdir development/samples/browseable ",
547}
548
549droiddoc {
550 name: "hidden-docs",
551 defaults: ["framework-docs-default"],
552 srcs: [
553 ":framework-doc-stubs",
554 ],
555 proofread_file: "hidden-docs-proofrerad.txt",
556 args: framework_docs_only_args +
557 " -referenceonly " +
558 " -title \"Android SDK - Including hidden APIs.\"",
559}