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