blob: a542c5cf245c7555d32c81273f129739a5596488 [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
Anton Hansson5aa59332022-01-21 16:32:31 +000058// These defaults enable doc-stub generation, api lint database generation and sdk value generation.
Jiyong Park7fb4b182019-12-20 14:35:43 +090059stubs_defaults {
Anton Hansson867f94c2021-05-05 10:32:31 +010060 name: "android-non-updatable-doc-stubs-defaults",
Anton Hansson87f04b82022-01-17 19:27:06 +000061 defaults: ["android-non-updatable-stubs-defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090062 srcs: [
Anton Hansson35c0b092021-03-30 10:46:48 +010063 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010064 ":android-test-base-sources",
65 ":android-test-mock-sources",
66 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090067 ],
68 libs: framework_docs_only_libs,
69 create_doc_stubs: true,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010070 write_sdk_values: true,
Jiyong Park7fb4b182019-12-20 14:35:43 +090071}
72
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010073// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010074stubs_defaults {
75 name: "framework-doc-stubs-sources-default",
Anton Hansson5aa59332022-01-21 16:32:31 +000076 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010077 srcs: [
Anton Hansson4468d7c2022-01-14 12:10:01 +000078 ":art.module.public.api{.public.stubs.source}",
79 ":conscrypt.module.public.api{.public.stubs.source}",
80 ":i18n.module.public.api{.public.stubs.source}",
81
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010082 ":framework-appsearch-sources",
83 ":framework-connectivity-sources",
Roopa Sattiraju86058b62022-01-20 10:05:19 -080084 ":framework-bluetooth-sources",
paulhuc100db52021-12-14 23:09:55 +080085 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010086 ":framework-graphics-srcs",
87 ":framework-mediaprovider-sources",
88 ":framework-permission-sources",
89 ":framework-permission-s-sources",
90 ":framework-scheduling-sources",
91 ":framework-sdkextensions-sources",
92 ":framework-statsd-sources",
93 ":framework-tethering-srcs",
94 ":framework-wifi-updatable-sources",
95 ":ike-srcs",
96 ":updatable-media-srcs",
97 ],
98}
99
Jiyong Park7fb4b182019-12-20 14:35:43 +0900100droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100101 name: "android-non-updatable-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000102 defaults: [
103 "android-non-updatable-doc-stubs-defaults",
104 "module-classpath-stubs-defaults",
105 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100106 args: metalava_framework_docs_args,
107}
108
109droidstubs {
110 name: "android-non-updatable-doc-stubs-system",
Anton Hansson5aa59332022-01-21 16:32:31 +0000111 defaults: [
112 "android-non-updatable-doc-stubs-defaults",
113 "module-classpath-stubs-defaults",
114 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100115 args: metalava_framework_docs_args +
116 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
117}
118
119droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900120 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100121 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000122 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000123 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Anton Hansson5aa59332022-01-21 16:32:31 +0000124 api_levels_annotations_enabled: true,
125 api_levels_annotations_dirs: [
126 "sdk-dir",
127 "api-versions-jars-dir",
128 ],
satayevbc7c83e2021-06-29 22:27:06 +0100129 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900130}
131
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100132droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000133 name: "framework-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000134 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hansson4468d7c2022-01-14 12:10:01 +0000135 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100136 args: metalava_framework_docs_args,
Anton Hansson247c5f22022-05-09 09:53:12 +0000137 api_levels_module: "api_versions_public",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100138 aidl: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100139 include_dirs: [
140 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddin235f9b12022-02-15 23:25:53 +0000141 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100142 ],
143 },
144}
145
Jiyong Park7fb4b182019-12-20 14:35:43 +0900146/////////////////////////////////////////////////////////////////////
147// API docs are created from the generated stub source files
148// using droiddoc
149/////////////////////////////////////////////////////////////////////
150
151framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
152 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
153 "-overview $(location core/java/overview.html) " +
154 // Federate Support Library references against local API file.
155 "-federate SupportLib https://developer.android.com " +
156 "-federationapi SupportLib $(location :current-support-api) " +
157 // Federate Support Library references against local API file.
158 "-federate AndroidX https://developer.android.com " +
159 "-federationapi AndroidX $(location :current-androidx-api) "
160
161doc_defaults {
162 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000163 libs: framework_docs_only_libs + [
164 "stub-annotations",
165 "unsupportedappusage",
166 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900167 html_dirs: [
168 "docs/html",
169 ],
170 knowntags: [
171 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100172 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900173 ],
174 custom_template: "droiddoc-templates-sdk",
175 resourcesdir: "docs/html/reference/images/",
176 resourcesoutdir: "reference/android/images/",
177 hdf: [
178 "dac true",
179 "sdk.codename O",
180 "sdk.preview.version 1",
181 "sdk.version 7.0",
182 "sdk.rel.id 1",
183 "sdk.preview 0",
184 ],
185 arg_files: [
186 "core/res/AndroidManifest.xml",
187 "core/java/overview.html",
188 ":current-support-api",
189 ":current-androidx-api",
190 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700191 // TODO(b/169090544): remove below aidl includes.
192 aidl: {
193 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600194 include_dirs: [
195 "frameworks/av/aidl",
196 "frameworks/native/libs/permission/aidl",
197 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700198 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900199}
200
201doc_defaults {
202 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900203}
204
205droiddoc {
206 name: "doc-comment-check-docs",
207 defaults: ["framework-docs-default"],
208 srcs: [
209 ":framework-doc-stubs",
210 ],
211 args: framework_docs_only_args + " -referenceonly -parsecomments",
212 installable: false,
213}
214
215droiddoc {
216 name: "offline-sdk-docs",
217 defaults: ["framework-docs-default"],
218 srcs: [
219 ":framework-doc-stubs",
220 ],
221 hdf: [
222 "android.whichdoc offline",
223 ],
atrostb1ee27b2020-02-03 11:03:16 +0000224 compat_config: ":global-compat-config",
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000225 proofread_file: "offline-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900226 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
227 static_doc_index_redirect: "docs/docs-preview-index.html",
228}
229
230droiddoc {
231 // Please sync with android-api-council@ before making any changes for the name property below.
232 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
233 // See b/116221385 for reference.
234 name: "offline-sdk-referenceonly-docs",
235 defaults: ["framework-docs-default"],
236 srcs: [
237 ":framework-doc-stubs",
238 ],
239 hdf: [
240 "android.whichdoc offline",
241 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000242 proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900243 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
244 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
245 static_doc_properties: "docs/source.properties",
246}
247
248droiddoc {
249 // Please sync with android-api-council@ before making any changes for the name property below.
250 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
251 // See b/116221385 for reference.
252 name: "offline-system-sdk-referenceonly-docs",
253 defaults: ["framework-docs-default"],
254 srcs: [
255 ":framework-doc-system-stubs",
256 ],
257 hdf: [
258 "android.whichdoc offline",
259 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000260 proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900261 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
262 " -offlinemode -title \"Android System SDK\" -referenceonly",
263 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
264 static_doc_properties: "docs/source.properties",
265}
266
267droiddoc {
268 name: "online-sdk-docs",
269 defaults: ["framework-docs-default"],
270 srcs: [
271 ":framework-doc-stubs",
272 ],
273 hdf: [
274 "android.whichdoc online",
275 "android.hasSamples true",
276 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000277 proofread_file: "online-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900278 args: framework_docs_only_args +
279 " -toroot / -samplegroup Admin " +
280 " -samplegroup Background " +
281 " -samplegroup Connectivity " +
282 " -samplegroup Content " +
283 " -samplegroup Input " +
284 " -samplegroup Media " +
285 " -samplegroup Notification " +
286 " -samplegroup RenderScript " +
287 " -samplegroup Security " +
288 " -samplegroup Sensors " +
289 " -samplegroup System " +
290 " -samplegroup Testing " +
291 " -samplegroup UI " +
292 " -samplegroup Views " +
293 " -samplegroup Wearable -samplesdir development/samples/browseable ",
294}
295
296droiddoc {
297 name: "online-system-api-sdk-docs",
298 defaults: ["framework-docs-default"],
299 srcs: [
300 ":framework-doc-system-stubs",
301 ],
302 hdf: [
303 "android.whichdoc online",
304 "android.hasSamples true",
305 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000306 proofread_file: "online-system-api-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900307 args: framework_docs_only_args +
308 " -referenceonly " +
309 " -title \"Android SDK - Including system APIs.\" " +
310 " -hide 101 " +
311 " -hide 104 " +
312 " -hide 108 " +
313 " -toroot / -samplegroup Admin " +
314 " -samplegroup Background " +
315 " -samplegroup Connectivity " +
316 " -samplegroup Content " +
317 " -samplegroup Input " +
318 " -samplegroup Media " +
319 " -samplegroup Notification " +
320 " -samplegroup RenderScript " +
321 " -samplegroup Security " +
322 " -samplegroup Sensors " +
323 " -samplegroup System " +
324 " -samplegroup Testing " +
325 " -samplegroup UI " +
326 " -samplegroup Views " +
327 " -samplegroup Wearable -samplesdir development/samples/browseable ",
328 installable: false,
329}
330
331droiddoc {
332 name: "ds-docs-java",
333 defaults: ["framework-docs-default"],
334 srcs: [
335 ":framework-doc-stubs",
336 ],
337 hdf: [
338 "android.whichdoc online",
339 "android.hasSamples true",
340 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000341 proofread_file: "ds-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900342 args: framework_docs_only_args +
343 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
344 " -samplegroup Background " +
345 " -samplegroup Connectivity " +
346 " -samplegroup Content " +
347 " -samplegroup Input " +
348 " -samplegroup Media " +
349 " -samplegroup Notification " +
350 " -samplegroup RenderScript " +
351 " -samplegroup Security " +
352 " -samplegroup Sensors " +
353 " -samplegroup System " +
354 " -samplegroup Testing " +
355 " -samplegroup UI " +
356 " -samplegroup Views " +
357 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
358}
359
360droiddoc {
361 name: "ds-docs-kt",
362 defaults: ["framework-dokka-docs-default"],
363 srcs: [
364 ":framework-doc-stubs",
365 ],
366 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700367 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900368 proofread_file: "ds-dokka-proofread.txt",
369 dokka_enabled: true,
370}
371
372java_genrule {
373 name: "ds-docs",
374 tools: [
375 "zip2zip",
376 "merge_zips",
377 ],
378 srcs: [
379 ":ds-docs-java{.docs.zip}",
380 ":ds-docs-kt{.docs.zip}",
381 ],
382 out: ["ds-docs.zip"],
383 dist: {
384 targets: ["docs"],
385 },
386 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 -0700387 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900388}
389
390java_genrule {
391 name: "ds-docs-switched",
392 tools: [
393 "switcher4",
394 "soong_zip",
395 ],
396 srcs: [
397 ":ds-docs-java{.docs.zip}",
398 ":ds-docs-kt{.docs.zip}",
399 ],
400 out: ["ds-docs-switched.zip"],
401 dist: {
402 targets: ["docs"],
403 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800404 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700405 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
406 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
407 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
408 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900409}
410
411droiddoc {
412 name: "ds-static-docs",
413 defaults: ["framework-docs-default"],
414 srcs: [
415 ":framework-doc-stubs",
416 ],
417 hdf: [
418 "android.whichdoc online",
419 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900420 args: framework_docs_only_args +
421 " -staticonly " +
422 " -toroot / " +
423 " -devsite " +
424 " -ignoreJdLinks ",
425}
426
427droiddoc {
428 name: "ds-ref-navtree-docs",
429 defaults: ["framework-docs-default"],
430 srcs: [
431 ":framework-doc-stubs",
432 ],
433 hdf: [
434 "android.whichdoc online",
435 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900436 args: framework_docs_only_args +
437 " -toroot / " +
438 " -atLinksNavtree " +
439 " -navtreeonly ",
440}
441
442droiddoc {
443 name: "online-sdk-dev-docs",
444 defaults: ["framework-docs-default"],
445 srcs: [
446 ":framework-doc-stubs",
447 ],
448 hdf: [
449 "android.whichdoc online",
450 "android.hasSamples true",
451 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000452 proofread_file: "online-sdk-dev-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900453 args: framework_docs_only_args +
454 " -toroot / -samplegroup Admin " +
455 " -samplegroup Background " +
456 " -samplegroup Connectivity " +
457 " -samplegroup Content " +
458 " -samplegroup Input " +
459 " -samplegroup Media " +
460 " -samplegroup Notification " +
461 " -samplegroup RenderScript " +
462 " -samplegroup Security " +
463 " -samplegroup Sensors " +
464 " -samplegroup System " +
465 " -samplegroup Testing " +
466 " -samplegroup UI " +
467 " -samplegroup Views " +
468 " -samplegroup Wearable -samplesdir development/samples/browseable ",
469}
470
471droiddoc {
472 name: "hidden-docs",
473 defaults: ["framework-docs-default"],
474 srcs: [
475 ":framework-doc-stubs",
476 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000477 proofread_file: "hidden-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900478 args: framework_docs_only_args +
479 " -referenceonly " +
480 " -title \"Android SDK - Including hidden APIs.\"",
481}