blob: 4aecc8fe45049ec62dab11f31b81a7de4816e3df [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
Anton Hansson35c0b092021-03-30 10:46:48 +010077 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010078 ":android-test-base-sources",
79 ":android-test-mock-sources",
80 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090081 ],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010082 arg_files: [
83 "core/res/AndroidManifest.xml",
84 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090085 libs: framework_docs_only_libs,
86 create_doc_stubs: true,
87 annotations_enabled: true,
Anton Hansson76ac4cc2021-05-05 19:22:52 +010088 filter_packages: packages_to_document,
Jiyong Park7fb4b182019-12-20 14:35:43 +090089 api_levels_annotations_enabled: true,
90 api_levels_annotations_dirs: [
91 "sdk-dir",
92 "api-versions-jars-dir",
93 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +010094 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090095 merge_annotations_dirs: [
96 "metalava-manual",
97 ],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010098 write_sdk_values: true,
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070099 // TODO(b/169090544): remove below aidl includes.
100 aidl: {
101 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600102 include_dirs: [
103 "frameworks/av/aidl",
104 "frameworks/native/libs/permission/aidl",
105 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700106 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900107}
108
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100109// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100110stubs_defaults {
111 name: "framework-doc-stubs-sources-default",
112 defaults: ["framework-doc-stubs-default"],
113 srcs: [
Anton Hanssonecf9fc32022-01-14 12:10:01 +0000114 ":art.module.public.api{.public.stubs.source}",
115 ":conscrypt.module.public.api{.public.stubs.source}",
116 ":i18n.module.public.api{.public.stubs.source}",
117
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100118 ":framework-appsearch-sources",
119 ":framework-connectivity-sources",
paulhuf45fe962021-12-14 23:09:55 +0800120 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100121 ":framework-graphics-srcs",
122 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -0700123 ":framework-nearby-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100124 ":framework-permission-sources",
125 ":framework-permission-s-sources",
126 ":framework-scheduling-sources",
127 ":framework-sdkextensions-sources",
128 ":framework-statsd-sources",
Gavin Corkerybc006442021-11-16 22:33:10 +0000129 ":framework-supplementalprocess-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100130 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -0700131 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100132 ":framework-wifi-updatable-sources",
133 ":ike-srcs",
134 ":updatable-media-srcs",
135 ],
136}
137
Jiyong Park7fb4b182019-12-20 14:35:43 +0900138droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100139 name: "android-non-updatable-doc-stubs",
140 defaults: ["android-non-updatable-doc-stubs-defaults"],
141 args: metalava_framework_docs_args,
142}
143
144droidstubs {
145 name: "android-non-updatable-doc-stubs-system",
146 defaults: ["android-non-updatable-doc-stubs-defaults"],
147 args: metalava_framework_docs_args +
148 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
149}
150
151droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900152 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100153 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000154 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000155 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100156 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900157}
158
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100159droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000160 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100161 defaults: ["framework-doc-stubs-default"],
Anton Hanssonecf9fc32022-01-14 12:10:01 +0000162 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100163 args: metalava_framework_docs_args,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100164 aidl: {
165 local_include_dirs: [
166 "apex/media/aidl/stable",
167 ],
168 include_dirs: [
169 "packages/modules/Connectivity/framework/aidl-export",
170 ],
171 },
172}
173
Jiyong Park7fb4b182019-12-20 14:35:43 +0900174/////////////////////////////////////////////////////////////////////
175// API docs are created from the generated stub source files
176// using droiddoc
177/////////////////////////////////////////////////////////////////////
178
179framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
180 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
181 "-overview $(location core/java/overview.html) " +
182 // Federate Support Library references against local API file.
183 "-federate SupportLib https://developer.android.com " +
184 "-federationapi SupportLib $(location :current-support-api) " +
185 // Federate Support Library references against local API file.
186 "-federate AndroidX https://developer.android.com " +
187 "-federationapi AndroidX $(location :current-androidx-api) "
188
189doc_defaults {
190 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000191 libs: framework_docs_only_libs + [
192 "stub-annotations",
193 "unsupportedappusage",
194 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900195 html_dirs: [
196 "docs/html",
197 ],
198 knowntags: [
199 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100200 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900201 ],
202 custom_template: "droiddoc-templates-sdk",
203 resourcesdir: "docs/html/reference/images/",
204 resourcesoutdir: "reference/android/images/",
205 hdf: [
206 "dac true",
207 "sdk.codename O",
208 "sdk.preview.version 1",
209 "sdk.version 7.0",
210 "sdk.rel.id 1",
211 "sdk.preview 0",
212 ],
213 arg_files: [
214 "core/res/AndroidManifest.xml",
215 "core/java/overview.html",
216 ":current-support-api",
217 ":current-androidx-api",
218 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700219 // TODO(b/169090544): remove below aidl includes.
220 aidl: {
221 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600222 include_dirs: [
223 "frameworks/av/aidl",
224 "frameworks/native/libs/permission/aidl",
225 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700226 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900227}
228
229doc_defaults {
230 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900231}
232
233droiddoc {
234 name: "doc-comment-check-docs",
235 defaults: ["framework-docs-default"],
236 srcs: [
237 ":framework-doc-stubs",
238 ],
239 args: framework_docs_only_args + " -referenceonly -parsecomments",
240 installable: false,
241}
242
243droiddoc {
244 name: "offline-sdk-docs",
245 defaults: ["framework-docs-default"],
246 srcs: [
247 ":framework-doc-stubs",
248 ],
249 hdf: [
250 "android.whichdoc offline",
251 ],
atrostb1ee27b2020-02-03 11:03:16 +0000252 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900253 proofread_file: "offline-sdk-docs-proofrerad.txt",
254 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
255 static_doc_index_redirect: "docs/docs-preview-index.html",
256}
257
258droiddoc {
259 // Please sync with android-api-council@ before making any changes for the name property below.
260 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
261 // See b/116221385 for reference.
262 name: "offline-sdk-referenceonly-docs",
263 defaults: ["framework-docs-default"],
264 srcs: [
265 ":framework-doc-stubs",
266 ],
267 hdf: [
268 "android.whichdoc offline",
269 ],
270 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
271 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
272 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
273 static_doc_properties: "docs/source.properties",
274}
275
276droiddoc {
277 // Please sync with android-api-council@ before making any changes for the name property below.
278 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
279 // See b/116221385 for reference.
280 name: "offline-system-sdk-referenceonly-docs",
281 defaults: ["framework-docs-default"],
282 srcs: [
283 ":framework-doc-system-stubs",
284 ],
285 hdf: [
286 "android.whichdoc offline",
287 ],
288 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
289 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
290 " -offlinemode -title \"Android System SDK\" -referenceonly",
291 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
292 static_doc_properties: "docs/source.properties",
293}
294
295droiddoc {
296 name: "online-sdk-docs",
297 defaults: ["framework-docs-default"],
298 srcs: [
299 ":framework-doc-stubs",
300 ],
301 hdf: [
302 "android.whichdoc online",
303 "android.hasSamples true",
304 ],
305 proofread_file: "online-sdk-docs-proofrerad.txt",
306 args: framework_docs_only_args +
307 " -toroot / -samplegroup Admin " +
308 " -samplegroup Background " +
309 " -samplegroup Connectivity " +
310 " -samplegroup Content " +
311 " -samplegroup Input " +
312 " -samplegroup Media " +
313 " -samplegroup Notification " +
314 " -samplegroup RenderScript " +
315 " -samplegroup Security " +
316 " -samplegroup Sensors " +
317 " -samplegroup System " +
318 " -samplegroup Testing " +
319 " -samplegroup UI " +
320 " -samplegroup Views " +
321 " -samplegroup Wearable -samplesdir development/samples/browseable ",
322}
323
324droiddoc {
325 name: "online-system-api-sdk-docs",
326 defaults: ["framework-docs-default"],
327 srcs: [
328 ":framework-doc-system-stubs",
329 ],
330 hdf: [
331 "android.whichdoc online",
332 "android.hasSamples true",
333 ],
334 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
335 args: framework_docs_only_args +
336 " -referenceonly " +
337 " -title \"Android SDK - Including system APIs.\" " +
338 " -hide 101 " +
339 " -hide 104 " +
340 " -hide 108 " +
341 " -toroot / -samplegroup Admin " +
342 " -samplegroup Background " +
343 " -samplegroup Connectivity " +
344 " -samplegroup Content " +
345 " -samplegroup Input " +
346 " -samplegroup Media " +
347 " -samplegroup Notification " +
348 " -samplegroup RenderScript " +
349 " -samplegroup Security " +
350 " -samplegroup Sensors " +
351 " -samplegroup System " +
352 " -samplegroup Testing " +
353 " -samplegroup UI " +
354 " -samplegroup Views " +
355 " -samplegroup Wearable -samplesdir development/samples/browseable ",
356 installable: false,
357}
358
359droiddoc {
360 name: "ds-docs-java",
361 defaults: ["framework-docs-default"],
362 srcs: [
363 ":framework-doc-stubs",
364 ],
365 hdf: [
366 "android.whichdoc online",
367 "android.hasSamples true",
368 ],
369 proofread_file: "ds-docs-proofrerad.txt",
370 args: framework_docs_only_args +
371 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
372 " -samplegroup Background " +
373 " -samplegroup Connectivity " +
374 " -samplegroup Content " +
375 " -samplegroup Input " +
376 " -samplegroup Media " +
377 " -samplegroup Notification " +
378 " -samplegroup RenderScript " +
379 " -samplegroup Security " +
380 " -samplegroup Sensors " +
381 " -samplegroup System " +
382 " -samplegroup Testing " +
383 " -samplegroup UI " +
384 " -samplegroup Views " +
385 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
386}
387
388droiddoc {
389 name: "ds-docs-kt",
390 defaults: ["framework-dokka-docs-default"],
391 srcs: [
392 ":framework-doc-stubs",
393 ],
394 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700395 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900396 proofread_file: "ds-dokka-proofread.txt",
397 dokka_enabled: true,
398}
399
400java_genrule {
401 name: "ds-docs",
402 tools: [
403 "zip2zip",
404 "merge_zips",
405 ],
406 srcs: [
407 ":ds-docs-java{.docs.zip}",
408 ":ds-docs-kt{.docs.zip}",
409 ],
410 out: ["ds-docs.zip"],
411 dist: {
412 targets: ["docs"],
413 },
414 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 -0700415 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900416}
417
418java_genrule {
419 name: "ds-docs-switched",
420 tools: [
421 "switcher4",
422 "soong_zip",
423 ],
424 srcs: [
425 ":ds-docs-java{.docs.zip}",
426 ":ds-docs-kt{.docs.zip}",
427 ],
428 out: ["ds-docs-switched.zip"],
429 dist: {
430 targets: ["docs"],
431 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800432 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700433 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
434 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
435 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
436 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900437}
438
439droiddoc {
440 name: "ds-static-docs",
441 defaults: ["framework-docs-default"],
442 srcs: [
443 ":framework-doc-stubs",
444 ],
445 hdf: [
446 "android.whichdoc online",
447 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900448 args: framework_docs_only_args +
449 " -staticonly " +
450 " -toroot / " +
451 " -devsite " +
452 " -ignoreJdLinks ",
453}
454
455droiddoc {
456 name: "ds-ref-navtree-docs",
457 defaults: ["framework-docs-default"],
458 srcs: [
459 ":framework-doc-stubs",
460 ],
461 hdf: [
462 "android.whichdoc online",
463 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900464 args: framework_docs_only_args +
465 " -toroot / " +
466 " -atLinksNavtree " +
467 " -navtreeonly ",
468}
469
470droiddoc {
471 name: "online-sdk-dev-docs",
472 defaults: ["framework-docs-default"],
473 srcs: [
474 ":framework-doc-stubs",
475 ],
476 hdf: [
477 "android.whichdoc online",
478 "android.hasSamples true",
479 ],
480 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
481 args: framework_docs_only_args +
482 " -toroot / -samplegroup Admin " +
483 " -samplegroup Background " +
484 " -samplegroup Connectivity " +
485 " -samplegroup Content " +
486 " -samplegroup Input " +
487 " -samplegroup Media " +
488 " -samplegroup Notification " +
489 " -samplegroup RenderScript " +
490 " -samplegroup Security " +
491 " -samplegroup Sensors " +
492 " -samplegroup System " +
493 " -samplegroup Testing " +
494 " -samplegroup UI " +
495 " -samplegroup Views " +
496 " -samplegroup Wearable -samplesdir development/samples/browseable ",
497}
498
499droiddoc {
500 name: "hidden-docs",
501 defaults: ["framework-docs-default"],
502 srcs: [
503 ":framework-doc-stubs",
504 ],
505 proofread_file: "hidden-docs-proofrerad.txt",
506 args: framework_docs_only_args +
507 " -referenceonly " +
508 " -title \"Android SDK - Including hidden APIs.\"",
509}