blob: 7d4a5e52df356aa227888c360dda471deeca5235 [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",
paulhuf45fe962021-12-14 23:09:55 +0800121 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100122 ":framework-graphics-srcs",
123 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -0700124 ":framework-nearby-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100125 ":framework-permission-sources",
126 ":framework-permission-s-sources",
127 ":framework-scheduling-sources",
128 ":framework-sdkextensions-sources",
129 ":framework-statsd-sources",
Gavin Corkerybc006442021-11-16 22:33:10 +0000130 ":framework-supplementalprocess-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100131 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700132 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100133 ":framework-wifi-updatable-sources",
134 ":ike-srcs",
135 ":updatable-media-srcs",
136 ],
137}
138
Jiyong Park7fb4b182019-12-20 14:35:43 +0900139droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100140 name: "android-non-updatable-doc-stubs",
141 defaults: ["android-non-updatable-doc-stubs-defaults"],
142 args: metalava_framework_docs_args,
143}
144
145droidstubs {
146 name: "android-non-updatable-doc-stubs-system",
147 defaults: ["android-non-updatable-doc-stubs-defaults"],
148 args: metalava_framework_docs_args +
149 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
150}
151
152droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900153 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100154 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000155 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000156 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100157 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900158}
159
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100160droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000161 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100162 defaults: ["framework-doc-stubs-default"],
163 args: metalava_framework_docs_args,
164 srcs: [
165 ":android.net.ipsec.ike{.public.stubs.source}",
166 ":framework-appsearch{.public.stubs.source}",
167 ":framework-connectivity{.public.stubs.source}",
paulhuf45fe962021-12-14 23:09:55 +0800168 ":framework-connectivity-tiramisu{.public.stubs.source}",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100169 ":framework-graphics{.public.stubs.source}",
170 ":framework-media{.public.stubs.source}",
171 ":framework-mediaprovider{.public.stubs.source}",
Chun Zhanga615ce52021-10-29 14:57:55 -0700172 ":framework-nearby{.public.stubs.source}",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100173 ":framework-permission{.public.stubs.source}",
174 ":framework-permission-s{.public.stubs.source}",
175 ":framework-scheduling{.public.stubs.source}",
176 ":framework-sdkextensions{.public.stubs.source}",
177 ":framework-statsd{.public.stubs.source}",
Gavin Corkerybc006442021-11-16 22:33:10 +0000178 ":framework-supplementalprocess{.public.stubs.source}",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100179 ":framework-tethering{.public.stubs.source}",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700180 ":framework-uwb{.public.stubs.source}",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100181 ":framework-wifi{.public.stubs.source}",
182 ],
183 aidl: {
184 local_include_dirs: [
185 "apex/media/aidl/stable",
186 ],
187 include_dirs: [
188 "packages/modules/Connectivity/framework/aidl-export",
189 ],
190 },
191}
192
Jiyong Park7fb4b182019-12-20 14:35:43 +0900193/////////////////////////////////////////////////////////////////////
194// API docs are created from the generated stub source files
195// using droiddoc
196/////////////////////////////////////////////////////////////////////
197
198framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
199 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
200 "-overview $(location core/java/overview.html) " +
201 // Federate Support Library references against local API file.
202 "-federate SupportLib https://developer.android.com " +
203 "-federationapi SupportLib $(location :current-support-api) " +
204 // Federate Support Library references against local API file.
205 "-federate AndroidX https://developer.android.com " +
206 "-federationapi AndroidX $(location :current-androidx-api) "
207
208doc_defaults {
209 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000210 libs: framework_docs_only_libs + [
211 "stub-annotations",
212 "unsupportedappusage",
213 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900214 html_dirs: [
215 "docs/html",
216 ],
217 knowntags: [
218 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100219 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900220 ],
221 custom_template: "droiddoc-templates-sdk",
222 resourcesdir: "docs/html/reference/images/",
223 resourcesoutdir: "reference/android/images/",
224 hdf: [
225 "dac true",
226 "sdk.codename O",
227 "sdk.preview.version 1",
228 "sdk.version 7.0",
229 "sdk.rel.id 1",
230 "sdk.preview 0",
231 ],
232 arg_files: [
233 "core/res/AndroidManifest.xml",
234 "core/java/overview.html",
235 ":current-support-api",
236 ":current-androidx-api",
237 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700238 // TODO(b/169090544): remove below aidl includes.
239 aidl: {
240 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600241 include_dirs: [
242 "frameworks/av/aidl",
243 "frameworks/native/libs/permission/aidl",
244 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700245 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900246}
247
248doc_defaults {
249 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900250}
251
252droiddoc {
253 name: "doc-comment-check-docs",
254 defaults: ["framework-docs-default"],
255 srcs: [
256 ":framework-doc-stubs",
257 ],
258 args: framework_docs_only_args + " -referenceonly -parsecomments",
259 installable: false,
260}
261
262droiddoc {
263 name: "offline-sdk-docs",
264 defaults: ["framework-docs-default"],
265 srcs: [
266 ":framework-doc-stubs",
267 ],
268 hdf: [
269 "android.whichdoc offline",
270 ],
atrostb1ee27b2020-02-03 11:03:16 +0000271 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900272 proofread_file: "offline-sdk-docs-proofrerad.txt",
273 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
274 static_doc_index_redirect: "docs/docs-preview-index.html",
275}
276
277droiddoc {
278 // Please sync with android-api-council@ before making any changes for the name property below.
279 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
280 // See b/116221385 for reference.
281 name: "offline-sdk-referenceonly-docs",
282 defaults: ["framework-docs-default"],
283 srcs: [
284 ":framework-doc-stubs",
285 ],
286 hdf: [
287 "android.whichdoc offline",
288 ],
289 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
290 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
291 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
292 static_doc_properties: "docs/source.properties",
293}
294
295droiddoc {
296 // Please sync with android-api-council@ before making any changes for the name property below.
297 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
298 // See b/116221385 for reference.
299 name: "offline-system-sdk-referenceonly-docs",
300 defaults: ["framework-docs-default"],
301 srcs: [
302 ":framework-doc-system-stubs",
303 ],
304 hdf: [
305 "android.whichdoc offline",
306 ],
307 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
308 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
309 " -offlinemode -title \"Android System SDK\" -referenceonly",
310 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
311 static_doc_properties: "docs/source.properties",
312}
313
314droiddoc {
315 name: "online-sdk-docs",
316 defaults: ["framework-docs-default"],
317 srcs: [
318 ":framework-doc-stubs",
319 ],
320 hdf: [
321 "android.whichdoc online",
322 "android.hasSamples true",
323 ],
324 proofread_file: "online-sdk-docs-proofrerad.txt",
325 args: framework_docs_only_args +
326 " -toroot / -samplegroup Admin " +
327 " -samplegroup Background " +
328 " -samplegroup Connectivity " +
329 " -samplegroup Content " +
330 " -samplegroup Input " +
331 " -samplegroup Media " +
332 " -samplegroup Notification " +
333 " -samplegroup RenderScript " +
334 " -samplegroup Security " +
335 " -samplegroup Sensors " +
336 " -samplegroup System " +
337 " -samplegroup Testing " +
338 " -samplegroup UI " +
339 " -samplegroup Views " +
340 " -samplegroup Wearable -samplesdir development/samples/browseable ",
341}
342
343droiddoc {
344 name: "online-system-api-sdk-docs",
345 defaults: ["framework-docs-default"],
346 srcs: [
347 ":framework-doc-system-stubs",
348 ],
349 hdf: [
350 "android.whichdoc online",
351 "android.hasSamples true",
352 ],
353 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
354 args: framework_docs_only_args +
355 " -referenceonly " +
356 " -title \"Android SDK - Including system APIs.\" " +
357 " -hide 101 " +
358 " -hide 104 " +
359 " -hide 108 " +
360 " -toroot / -samplegroup Admin " +
361 " -samplegroup Background " +
362 " -samplegroup Connectivity " +
363 " -samplegroup Content " +
364 " -samplegroup Input " +
365 " -samplegroup Media " +
366 " -samplegroup Notification " +
367 " -samplegroup RenderScript " +
368 " -samplegroup Security " +
369 " -samplegroup Sensors " +
370 " -samplegroup System " +
371 " -samplegroup Testing " +
372 " -samplegroup UI " +
373 " -samplegroup Views " +
374 " -samplegroup Wearable -samplesdir development/samples/browseable ",
375 installable: false,
376}
377
378droiddoc {
379 name: "ds-docs-java",
380 defaults: ["framework-docs-default"],
381 srcs: [
382 ":framework-doc-stubs",
383 ],
384 hdf: [
385 "android.whichdoc online",
386 "android.hasSamples true",
387 ],
388 proofread_file: "ds-docs-proofrerad.txt",
389 args: framework_docs_only_args +
390 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
391 " -samplegroup Background " +
392 " -samplegroup Connectivity " +
393 " -samplegroup Content " +
394 " -samplegroup Input " +
395 " -samplegroup Media " +
396 " -samplegroup Notification " +
397 " -samplegroup RenderScript " +
398 " -samplegroup Security " +
399 " -samplegroup Sensors " +
400 " -samplegroup System " +
401 " -samplegroup Testing " +
402 " -samplegroup UI " +
403 " -samplegroup Views " +
404 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
405}
406
407droiddoc {
408 name: "ds-docs-kt",
409 defaults: ["framework-dokka-docs-default"],
410 srcs: [
411 ":framework-doc-stubs",
412 ],
413 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700414 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900415 proofread_file: "ds-dokka-proofread.txt",
416 dokka_enabled: true,
417}
418
419java_genrule {
420 name: "ds-docs",
421 tools: [
422 "zip2zip",
423 "merge_zips",
424 ],
425 srcs: [
426 ":ds-docs-java{.docs.zip}",
427 ":ds-docs-kt{.docs.zip}",
428 ],
429 out: ["ds-docs.zip"],
430 dist: {
431 targets: ["docs"],
432 },
433 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 -0700434 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900435}
436
437java_genrule {
438 name: "ds-docs-switched",
439 tools: [
440 "switcher4",
441 "soong_zip",
442 ],
443 srcs: [
444 ":ds-docs-java{.docs.zip}",
445 ":ds-docs-kt{.docs.zip}",
446 ],
447 out: ["ds-docs-switched.zip"],
448 dist: {
449 targets: ["docs"],
450 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800451 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700452 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
453 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
454 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
455 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900456}
457
458droiddoc {
459 name: "ds-static-docs",
460 defaults: ["framework-docs-default"],
461 srcs: [
462 ":framework-doc-stubs",
463 ],
464 hdf: [
465 "android.whichdoc online",
466 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900467 args: framework_docs_only_args +
468 " -staticonly " +
469 " -toroot / " +
470 " -devsite " +
471 " -ignoreJdLinks ",
472}
473
474droiddoc {
475 name: "ds-ref-navtree-docs",
476 defaults: ["framework-docs-default"],
477 srcs: [
478 ":framework-doc-stubs",
479 ],
480 hdf: [
481 "android.whichdoc online",
482 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900483 args: framework_docs_only_args +
484 " -toroot / " +
485 " -atLinksNavtree " +
486 " -navtreeonly ",
487}
488
489droiddoc {
490 name: "online-sdk-dev-docs",
491 defaults: ["framework-docs-default"],
492 srcs: [
493 ":framework-doc-stubs",
494 ],
495 hdf: [
496 "android.whichdoc online",
497 "android.hasSamples true",
498 ],
499 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
500 args: framework_docs_only_args +
501 " -toroot / -samplegroup Admin " +
502 " -samplegroup Background " +
503 " -samplegroup Connectivity " +
504 " -samplegroup Content " +
505 " -samplegroup Input " +
506 " -samplegroup Media " +
507 " -samplegroup Notification " +
508 " -samplegroup RenderScript " +
509 " -samplegroup Security " +
510 " -samplegroup Sensors " +
511 " -samplegroup System " +
512 " -samplegroup Testing " +
513 " -samplegroup UI " +
514 " -samplegroup Views " +
515 " -samplegroup Wearable -samplesdir development/samples/browseable ",
516}
517
518droiddoc {
519 name: "hidden-docs",
520 defaults: ["framework-docs-default"],
521 srcs: [
522 ":framework-doc-stubs",
523 ],
524 proofread_file: "hidden-docs-proofrerad.txt",
525 args: framework_docs_only_args +
526 " -referenceonly " +
527 " -title \"Android SDK - Including hidden APIs.\"",
528}