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