blob: ec7b19482c823d07dde0ca122666259ac40a45f7 [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 Hansson4468d7c2022-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",
paulhuc100db52021-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",
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"],
Anton Hansson4468d7c2022-01-14 12:10:01 +0000159 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100160 args: metalava_framework_docs_args,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100161 aidl: {
162 local_include_dirs: [
163 "apex/media/aidl/stable",
164 ],
165 include_dirs: [
166 "packages/modules/Connectivity/framework/aidl-export",
167 ],
168 },
169}
170
Jiyong Park7fb4b182019-12-20 14:35:43 +0900171/////////////////////////////////////////////////////////////////////
172// API docs are created from the generated stub source files
173// using droiddoc
174/////////////////////////////////////////////////////////////////////
175
176framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
177 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
178 "-overview $(location core/java/overview.html) " +
179 // Federate Support Library references against local API file.
180 "-federate SupportLib https://developer.android.com " +
181 "-federationapi SupportLib $(location :current-support-api) " +
182 // Federate Support Library references against local API file.
183 "-federate AndroidX https://developer.android.com " +
184 "-federationapi AndroidX $(location :current-androidx-api) "
185
186doc_defaults {
187 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000188 libs: framework_docs_only_libs + [
189 "stub-annotations",
190 "unsupportedappusage",
191 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900192 html_dirs: [
193 "docs/html",
194 ],
195 knowntags: [
196 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100197 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900198 ],
199 custom_template: "droiddoc-templates-sdk",
200 resourcesdir: "docs/html/reference/images/",
201 resourcesoutdir: "reference/android/images/",
202 hdf: [
203 "dac true",
204 "sdk.codename O",
205 "sdk.preview.version 1",
206 "sdk.version 7.0",
207 "sdk.rel.id 1",
208 "sdk.preview 0",
209 ],
210 arg_files: [
211 "core/res/AndroidManifest.xml",
212 "core/java/overview.html",
213 ":current-support-api",
214 ":current-androidx-api",
215 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700216 // TODO(b/169090544): remove below aidl includes.
217 aidl: {
218 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600219 include_dirs: [
220 "frameworks/av/aidl",
221 "frameworks/native/libs/permission/aidl",
222 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700223 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224}
225
226doc_defaults {
227 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900228}
229
230droiddoc {
231 name: "doc-comment-check-docs",
232 defaults: ["framework-docs-default"],
233 srcs: [
234 ":framework-doc-stubs",
235 ],
236 args: framework_docs_only_args + " -referenceonly -parsecomments",
237 installable: false,
238}
239
240droiddoc {
241 name: "offline-sdk-docs",
242 defaults: ["framework-docs-default"],
243 srcs: [
244 ":framework-doc-stubs",
245 ],
246 hdf: [
247 "android.whichdoc offline",
248 ],
atrostb1ee27b2020-02-03 11:03:16 +0000249 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900250 proofread_file: "offline-sdk-docs-proofrerad.txt",
251 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
252 static_doc_index_redirect: "docs/docs-preview-index.html",
253}
254
255droiddoc {
256 // Please sync with android-api-council@ before making any changes for the name property below.
257 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
258 // See b/116221385 for reference.
259 name: "offline-sdk-referenceonly-docs",
260 defaults: ["framework-docs-default"],
261 srcs: [
262 ":framework-doc-stubs",
263 ],
264 hdf: [
265 "android.whichdoc offline",
266 ],
267 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
268 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
269 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
270 static_doc_properties: "docs/source.properties",
271}
272
273droiddoc {
274 // Please sync with android-api-council@ before making any changes for the name property below.
275 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
276 // See b/116221385 for reference.
277 name: "offline-system-sdk-referenceonly-docs",
278 defaults: ["framework-docs-default"],
279 srcs: [
280 ":framework-doc-system-stubs",
281 ],
282 hdf: [
283 "android.whichdoc offline",
284 ],
285 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
286 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
287 " -offlinemode -title \"Android System SDK\" -referenceonly",
288 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
289 static_doc_properties: "docs/source.properties",
290}
291
292droiddoc {
293 name: "online-sdk-docs",
294 defaults: ["framework-docs-default"],
295 srcs: [
296 ":framework-doc-stubs",
297 ],
298 hdf: [
299 "android.whichdoc online",
300 "android.hasSamples true",
301 ],
302 proofread_file: "online-sdk-docs-proofrerad.txt",
303 args: framework_docs_only_args +
304 " -toroot / -samplegroup Admin " +
305 " -samplegroup Background " +
306 " -samplegroup Connectivity " +
307 " -samplegroup Content " +
308 " -samplegroup Input " +
309 " -samplegroup Media " +
310 " -samplegroup Notification " +
311 " -samplegroup RenderScript " +
312 " -samplegroup Security " +
313 " -samplegroup Sensors " +
314 " -samplegroup System " +
315 " -samplegroup Testing " +
316 " -samplegroup UI " +
317 " -samplegroup Views " +
318 " -samplegroup Wearable -samplesdir development/samples/browseable ",
319}
320
321droiddoc {
322 name: "online-system-api-sdk-docs",
323 defaults: ["framework-docs-default"],
324 srcs: [
325 ":framework-doc-system-stubs",
326 ],
327 hdf: [
328 "android.whichdoc online",
329 "android.hasSamples true",
330 ],
331 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
332 args: framework_docs_only_args +
333 " -referenceonly " +
334 " -title \"Android SDK - Including system APIs.\" " +
335 " -hide 101 " +
336 " -hide 104 " +
337 " -hide 108 " +
338 " -toroot / -samplegroup Admin " +
339 " -samplegroup Background " +
340 " -samplegroup Connectivity " +
341 " -samplegroup Content " +
342 " -samplegroup Input " +
343 " -samplegroup Media " +
344 " -samplegroup Notification " +
345 " -samplegroup RenderScript " +
346 " -samplegroup Security " +
347 " -samplegroup Sensors " +
348 " -samplegroup System " +
349 " -samplegroup Testing " +
350 " -samplegroup UI " +
351 " -samplegroup Views " +
352 " -samplegroup Wearable -samplesdir development/samples/browseable ",
353 installable: false,
354}
355
356droiddoc {
357 name: "ds-docs-java",
358 defaults: ["framework-docs-default"],
359 srcs: [
360 ":framework-doc-stubs",
361 ],
362 hdf: [
363 "android.whichdoc online",
364 "android.hasSamples true",
365 ],
366 proofread_file: "ds-docs-proofrerad.txt",
367 args: framework_docs_only_args +
368 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
369 " -samplegroup Background " +
370 " -samplegroup Connectivity " +
371 " -samplegroup Content " +
372 " -samplegroup Input " +
373 " -samplegroup Media " +
374 " -samplegroup Notification " +
375 " -samplegroup RenderScript " +
376 " -samplegroup Security " +
377 " -samplegroup Sensors " +
378 " -samplegroup System " +
379 " -samplegroup Testing " +
380 " -samplegroup UI " +
381 " -samplegroup Views " +
382 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
383}
384
385droiddoc {
386 name: "ds-docs-kt",
387 defaults: ["framework-dokka-docs-default"],
388 srcs: [
389 ":framework-doc-stubs",
390 ],
391 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700392 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900393 proofread_file: "ds-dokka-proofread.txt",
394 dokka_enabled: true,
395}
396
397java_genrule {
398 name: "ds-docs",
399 tools: [
400 "zip2zip",
401 "merge_zips",
402 ],
403 srcs: [
404 ":ds-docs-java{.docs.zip}",
405 ":ds-docs-kt{.docs.zip}",
406 ],
407 out: ["ds-docs.zip"],
408 dist: {
409 targets: ["docs"],
410 },
411 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 -0700412 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900413}
414
415java_genrule {
416 name: "ds-docs-switched",
417 tools: [
418 "switcher4",
419 "soong_zip",
420 ],
421 srcs: [
422 ":ds-docs-java{.docs.zip}",
423 ":ds-docs-kt{.docs.zip}",
424 ],
425 out: ["ds-docs-switched.zip"],
426 dist: {
427 targets: ["docs"],
428 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800429 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700430 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
431 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
432 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
433 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900434}
435
436droiddoc {
437 name: "ds-static-docs",
438 defaults: ["framework-docs-default"],
439 srcs: [
440 ":framework-doc-stubs",
441 ],
442 hdf: [
443 "android.whichdoc online",
444 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900445 args: framework_docs_only_args +
446 " -staticonly " +
447 " -toroot / " +
448 " -devsite " +
449 " -ignoreJdLinks ",
450}
451
452droiddoc {
453 name: "ds-ref-navtree-docs",
454 defaults: ["framework-docs-default"],
455 srcs: [
456 ":framework-doc-stubs",
457 ],
458 hdf: [
459 "android.whichdoc online",
460 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900461 args: framework_docs_only_args +
462 " -toroot / " +
463 " -atLinksNavtree " +
464 " -navtreeonly ",
465}
466
467droiddoc {
468 name: "online-sdk-dev-docs",
469 defaults: ["framework-docs-default"],
470 srcs: [
471 ":framework-doc-stubs",
472 ],
473 hdf: [
474 "android.whichdoc online",
475 "android.hasSamples true",
476 ],
477 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
478 args: framework_docs_only_args +
479 " -toroot / -samplegroup Admin " +
480 " -samplegroup Background " +
481 " -samplegroup Connectivity " +
482 " -samplegroup Content " +
483 " -samplegroup Input " +
484 " -samplegroup Media " +
485 " -samplegroup Notification " +
486 " -samplegroup RenderScript " +
487 " -samplegroup Security " +
488 " -samplegroup Sensors " +
489 " -samplegroup System " +
490 " -samplegroup Testing " +
491 " -samplegroup UI " +
492 " -samplegroup Views " +
493 " -samplegroup Wearable -samplesdir development/samples/browseable ",
494}
495
496droiddoc {
497 name: "hidden-docs",
498 defaults: ["framework-docs-default"],
499 srcs: [
500 ":framework-doc-stubs",
501 ],
502 proofread_file: "hidden-docs-proofrerad.txt",
503 args: framework_docs_only_args +
504 " -referenceonly " +
505 " -title \"Android SDK - Including hidden APIs.\"",
506}