blob: d6b032211d43f7a53d1d73ebadf9a992ac93d719 [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.
Anton Hansson78549802022-01-17 18:14:55 +000063 ":android-test-base-sources",
64 ":android-test-mock-sources",
65 ":android-test-runner-sources",
Anton Hansson867f94c2021-05-05 10:32:31 +010066 ],
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",
129 ":framework-wifi-updatable-sources",
130 ":ike-srcs",
131 ":updatable-media-srcs",
132 ],
133}
134
Jiyong Park7fb4b182019-12-20 14:35:43 +0900135droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100136 name: "android-non-updatable-doc-stubs",
137 defaults: ["android-non-updatable-doc-stubs-defaults"],
138 args: metalava_framework_docs_args,
139}
140
141droidstubs {
142 name: "android-non-updatable-doc-stubs-system",
143 defaults: ["android-non-updatable-doc-stubs-defaults"],
144 args: metalava_framework_docs_args +
145 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
146}
147
148droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900149 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100150 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000151 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000152 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100153 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900154}
155
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100156droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000157 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100158 defaults: ["framework-doc-stubs-default"],
159 args: metalava_framework_docs_args,
160 srcs: [
161 ":android.net.ipsec.ike{.public.stubs.source}",
162 ":framework-appsearch{.public.stubs.source}",
163 ":framework-connectivity{.public.stubs.source}",
164 ":framework-graphics{.public.stubs.source}",
165 ":framework-media{.public.stubs.source}",
166 ":framework-mediaprovider{.public.stubs.source}",
167 ":framework-permission{.public.stubs.source}",
168 ":framework-permission-s{.public.stubs.source}",
169 ":framework-scheduling{.public.stubs.source}",
170 ":framework-sdkextensions{.public.stubs.source}",
171 ":framework-statsd{.public.stubs.source}",
172 ":framework-tethering{.public.stubs.source}",
173 ":framework-wifi{.public.stubs.source}",
174 ],
175 aidl: {
176 local_include_dirs: [
177 "apex/media/aidl/stable",
178 ],
179 include_dirs: [
180 "packages/modules/Connectivity/framework/aidl-export",
181 ],
182 },
183}
184
Anton Hansson1bf568e2021-09-24 13:16:19 +0100185// This produces the same annotations.zip as framework-doc-stubs, but by using
186// outputs from individual modules instead of all the source code.
187genrule {
188 name: "sdk-annotations.zip",
189 srcs: [
190 ":android-non-updatable-doc-stubs{.annotations.zip}",
191
192 // Conscrypt and i18n currently do not enable annotations
193 // ":conscrypt.module.public.api{.public.annotations.zip}",
194 // ":i18n.module.public.api{.public.annotations.zip}",
195
196 // Modules that enable annotations below
197 ":android.net.ipsec.ike{.public.annotations.zip}",
198 ":art.module.public.api{.public.annotations.zip}",
199 ":framework-appsearch{.public.annotations.zip}",
200 ":framework-connectivity{.public.annotations.zip}",
201 ":framework-graphics{.public.annotations.zip}",
202 ":framework-media{.public.annotations.zip}",
203 ":framework-mediaprovider{.public.annotations.zip}",
204 ":framework-permission{.public.annotations.zip}",
205 ":framework-permission-s{.public.annotations.zip}",
206 ":framework-scheduling{.public.annotations.zip}",
207 ":framework-sdkextensions{.public.annotations.zip}",
208 ":framework-statsd{.public.annotations.zip}",
209 ":framework-tethering{.public.annotations.zip}",
210 ":framework-wifi{.public.annotations.zip}",
211 ],
212 out: ["annotations.zip"],
213 tools: [
214 "merge_annotation_zips",
215 "soong_zip",
216 ],
217 cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
218 "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
219}
220
Jiyong Park7fb4b182019-12-20 14:35:43 +0900221/////////////////////////////////////////////////////////////////////
222// API docs are created from the generated stub source files
223// using droiddoc
224/////////////////////////////////////////////////////////////////////
225
226framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
227 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
228 "-overview $(location core/java/overview.html) " +
229 // Federate Support Library references against local API file.
230 "-federate SupportLib https://developer.android.com " +
231 "-federationapi SupportLib $(location :current-support-api) " +
232 // Federate Support Library references against local API file.
233 "-federate AndroidX https://developer.android.com " +
234 "-federationapi AndroidX $(location :current-androidx-api) "
235
236doc_defaults {
237 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000238 libs: framework_docs_only_libs + [
239 "stub-annotations",
240 "unsupportedappusage",
241 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900242 html_dirs: [
243 "docs/html",
244 ],
245 knowntags: [
246 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100247 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900248 ],
249 custom_template: "droiddoc-templates-sdk",
250 resourcesdir: "docs/html/reference/images/",
251 resourcesoutdir: "reference/android/images/",
252 hdf: [
253 "dac true",
254 "sdk.codename O",
255 "sdk.preview.version 1",
256 "sdk.version 7.0",
257 "sdk.rel.id 1",
258 "sdk.preview 0",
259 ],
260 arg_files: [
261 "core/res/AndroidManifest.xml",
262 "core/java/overview.html",
263 ":current-support-api",
264 ":current-androidx-api",
265 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700266 // TODO(b/169090544): remove below aidl includes.
267 aidl: {
268 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600269 include_dirs: [
270 "frameworks/av/aidl",
271 "frameworks/native/libs/permission/aidl",
272 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700273 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900274}
275
276doc_defaults {
277 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900278}
279
280droiddoc {
281 name: "doc-comment-check-docs",
282 defaults: ["framework-docs-default"],
283 srcs: [
284 ":framework-doc-stubs",
285 ],
286 args: framework_docs_only_args + " -referenceonly -parsecomments",
287 installable: false,
288}
289
290droiddoc {
291 name: "offline-sdk-docs",
292 defaults: ["framework-docs-default"],
293 srcs: [
294 ":framework-doc-stubs",
295 ],
296 hdf: [
297 "android.whichdoc offline",
298 ],
atrostb1ee27b2020-02-03 11:03:16 +0000299 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900300 proofread_file: "offline-sdk-docs-proofrerad.txt",
301 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
302 static_doc_index_redirect: "docs/docs-preview-index.html",
303}
304
305droiddoc {
306 // Please sync with android-api-council@ before making any changes for the name property below.
307 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
308 // See b/116221385 for reference.
309 name: "offline-sdk-referenceonly-docs",
310 defaults: ["framework-docs-default"],
311 srcs: [
312 ":framework-doc-stubs",
313 ],
314 hdf: [
315 "android.whichdoc offline",
316 ],
317 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
318 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
319 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
320 static_doc_properties: "docs/source.properties",
321}
322
323droiddoc {
324 // Please sync with android-api-council@ before making any changes for the name property below.
325 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
326 // See b/116221385 for reference.
327 name: "offline-system-sdk-referenceonly-docs",
328 defaults: ["framework-docs-default"],
329 srcs: [
330 ":framework-doc-system-stubs",
331 ],
332 hdf: [
333 "android.whichdoc offline",
334 ],
335 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
336 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
337 " -offlinemode -title \"Android System SDK\" -referenceonly",
338 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
339 static_doc_properties: "docs/source.properties",
340}
341
342droiddoc {
343 name: "online-sdk-docs",
344 defaults: ["framework-docs-default"],
345 srcs: [
346 ":framework-doc-stubs",
347 ],
348 hdf: [
349 "android.whichdoc online",
350 "android.hasSamples true",
351 ],
352 proofread_file: "online-sdk-docs-proofrerad.txt",
353 args: framework_docs_only_args +
354 " -toroot / -samplegroup Admin " +
355 " -samplegroup Background " +
356 " -samplegroup Connectivity " +
357 " -samplegroup Content " +
358 " -samplegroup Input " +
359 " -samplegroup Media " +
360 " -samplegroup Notification " +
361 " -samplegroup RenderScript " +
362 " -samplegroup Security " +
363 " -samplegroup Sensors " +
364 " -samplegroup System " +
365 " -samplegroup Testing " +
366 " -samplegroup UI " +
367 " -samplegroup Views " +
368 " -samplegroup Wearable -samplesdir development/samples/browseable ",
369}
370
371droiddoc {
372 name: "online-system-api-sdk-docs",
373 defaults: ["framework-docs-default"],
374 srcs: [
375 ":framework-doc-system-stubs",
376 ],
377 hdf: [
378 "android.whichdoc online",
379 "android.hasSamples true",
380 ],
381 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
382 args: framework_docs_only_args +
383 " -referenceonly " +
384 " -title \"Android SDK - Including system APIs.\" " +
385 " -hide 101 " +
386 " -hide 104 " +
387 " -hide 108 " +
388 " -toroot / -samplegroup Admin " +
389 " -samplegroup Background " +
390 " -samplegroup Connectivity " +
391 " -samplegroup Content " +
392 " -samplegroup Input " +
393 " -samplegroup Media " +
394 " -samplegroup Notification " +
395 " -samplegroup RenderScript " +
396 " -samplegroup Security " +
397 " -samplegroup Sensors " +
398 " -samplegroup System " +
399 " -samplegroup Testing " +
400 " -samplegroup UI " +
401 " -samplegroup Views " +
402 " -samplegroup Wearable -samplesdir development/samples/browseable ",
403 installable: false,
404}
405
406droiddoc {
407 name: "ds-docs-java",
408 defaults: ["framework-docs-default"],
409 srcs: [
410 ":framework-doc-stubs",
411 ],
412 hdf: [
413 "android.whichdoc online",
414 "android.hasSamples true",
415 ],
416 proofread_file: "ds-docs-proofrerad.txt",
417 args: framework_docs_only_args +
418 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
419 " -samplegroup Background " +
420 " -samplegroup Connectivity " +
421 " -samplegroup Content " +
422 " -samplegroup Input " +
423 " -samplegroup Media " +
424 " -samplegroup Notification " +
425 " -samplegroup RenderScript " +
426 " -samplegroup Security " +
427 " -samplegroup Sensors " +
428 " -samplegroup System " +
429 " -samplegroup Testing " +
430 " -samplegroup UI " +
431 " -samplegroup Views " +
432 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
433}
434
435droiddoc {
436 name: "ds-docs-kt",
437 defaults: ["framework-dokka-docs-default"],
438 srcs: [
439 ":framework-doc-stubs",
440 ],
441 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700442 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900443 proofread_file: "ds-dokka-proofread.txt",
444 dokka_enabled: true,
445}
446
447java_genrule {
448 name: "ds-docs",
449 tools: [
450 "zip2zip",
451 "merge_zips",
452 ],
453 srcs: [
454 ":ds-docs-java{.docs.zip}",
455 ":ds-docs-kt{.docs.zip}",
456 ],
457 out: ["ds-docs.zip"],
458 dist: {
459 targets: ["docs"],
460 },
461 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 -0700462 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900463}
464
465java_genrule {
466 name: "ds-docs-switched",
467 tools: [
468 "switcher4",
469 "soong_zip",
470 ],
471 srcs: [
472 ":ds-docs-java{.docs.zip}",
473 ":ds-docs-kt{.docs.zip}",
474 ],
475 out: ["ds-docs-switched.zip"],
476 dist: {
477 targets: ["docs"],
478 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800479 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700480 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
481 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
482 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
483 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900484}
485
486droiddoc {
487 name: "ds-static-docs",
488 defaults: ["framework-docs-default"],
489 srcs: [
490 ":framework-doc-stubs",
491 ],
492 hdf: [
493 "android.whichdoc online",
494 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900495 args: framework_docs_only_args +
496 " -staticonly " +
497 " -toroot / " +
498 " -devsite " +
499 " -ignoreJdLinks ",
500}
501
502droiddoc {
503 name: "ds-ref-navtree-docs",
504 defaults: ["framework-docs-default"],
505 srcs: [
506 ":framework-doc-stubs",
507 ],
508 hdf: [
509 "android.whichdoc online",
510 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900511 args: framework_docs_only_args +
512 " -toroot / " +
513 " -atLinksNavtree " +
514 " -navtreeonly ",
515}
516
517droiddoc {
518 name: "online-sdk-dev-docs",
519 defaults: ["framework-docs-default"],
520 srcs: [
521 ":framework-doc-stubs",
522 ],
523 hdf: [
524 "android.whichdoc online",
525 "android.hasSamples true",
526 ],
527 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
528 args: framework_docs_only_args +
529 " -toroot / -samplegroup Admin " +
530 " -samplegroup Background " +
531 " -samplegroup Connectivity " +
532 " -samplegroup Content " +
533 " -samplegroup Input " +
534 " -samplegroup Media " +
535 " -samplegroup Notification " +
536 " -samplegroup RenderScript " +
537 " -samplegroup Security " +
538 " -samplegroup Sensors " +
539 " -samplegroup System " +
540 " -samplegroup Testing " +
541 " -samplegroup UI " +
542 " -samplegroup Views " +
543 " -samplegroup Wearable -samplesdir development/samples/browseable ",
544}
545
546droiddoc {
547 name: "hidden-docs",
548 defaults: ["framework-docs-default"],
549 srcs: [
550 ":framework-doc-stubs",
551 ],
552 proofread_file: "hidden-docs-proofrerad.txt",
553 args: framework_docs_only_args +
554 " -referenceonly " +
555 " -title \"Android SDK - Including hidden APIs.\"",
556}