blob: a926ddc218a6138ce2e4e7efb0f809422114305a [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.
115// This is the default/normal.
116stubs_defaults {
117 name: "framework-doc-stubs-sources-default",
118 defaults: ["framework-doc-stubs-default"],
119 srcs: [
120 ":framework-appsearch-sources",
121 ":framework-connectivity-sources",
122 ":framework-graphics-srcs",
123 ":framework-mediaprovider-sources",
124 ":framework-permission-sources",
125 ":framework-permission-s-sources",
126 ":framework-scheduling-sources",
127 ":framework-sdkextensions-sources",
128 ":framework-statsd-sources",
129 ":framework-tethering-srcs",
130 ":framework-wifi-updatable-sources",
131 ":ike-srcs",
132 ":updatable-media-srcs",
133 ],
134}
135
Jiyong Park7fb4b182019-12-20 14:35:43 +0900136droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100137 name: "android-non-updatable-doc-stubs",
138 defaults: ["android-non-updatable-doc-stubs-defaults"],
139 args: metalava_framework_docs_args,
140}
141
142droidstubs {
143 name: "android-non-updatable-doc-stubs-system",
144 defaults: ["android-non-updatable-doc-stubs-defaults"],
145 args: metalava_framework_docs_args +
146 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
147}
148
149droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900150 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100151 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson26c843f2021-05-05 11:11:57 +0100152 args: metalava_framework_docs_args,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900153}
154
155droidstubs {
156 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100157 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000158 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000159 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100160 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900161}
162
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100163// Experimental target building doc stubs with module stub source code as input.
164// This is intended to eventually replace framework-doc-stubs, once all diffs
165// have been eliminated.
166droidstubs {
167 name: "framework-doc-stubs-module-stubs",
168 defaults: ["framework-doc-stubs-default"],
169 args: metalava_framework_docs_args,
170 srcs: [
171 ":android.net.ipsec.ike{.public.stubs.source}",
172 ":framework-appsearch{.public.stubs.source}",
173 ":framework-connectivity{.public.stubs.source}",
174 ":framework-graphics{.public.stubs.source}",
175 ":framework-media{.public.stubs.source}",
176 ":framework-mediaprovider{.public.stubs.source}",
177 ":framework-permission{.public.stubs.source}",
178 ":framework-permission-s{.public.stubs.source}",
179 ":framework-scheduling{.public.stubs.source}",
180 ":framework-sdkextensions{.public.stubs.source}",
181 ":framework-statsd{.public.stubs.source}",
182 ":framework-tethering{.public.stubs.source}",
183 ":framework-wifi{.public.stubs.source}",
184 ],
185 aidl: {
186 local_include_dirs: [
187 "apex/media/aidl/stable",
188 ],
189 include_dirs: [
190 "packages/modules/Connectivity/framework/aidl-export",
191 ],
192 },
193}
194
Anton Hansson1bf568e2021-09-24 13:16:19 +0100195// This produces the same annotations.zip as framework-doc-stubs, but by using
196// outputs from individual modules instead of all the source code.
197genrule {
198 name: "sdk-annotations.zip",
199 srcs: [
200 ":android-non-updatable-doc-stubs{.annotations.zip}",
201
202 // Conscrypt and i18n currently do not enable annotations
203 // ":conscrypt.module.public.api{.public.annotations.zip}",
204 // ":i18n.module.public.api{.public.annotations.zip}",
205
206 // Modules that enable annotations below
207 ":android.net.ipsec.ike{.public.annotations.zip}",
208 ":art.module.public.api{.public.annotations.zip}",
209 ":framework-appsearch{.public.annotations.zip}",
210 ":framework-connectivity{.public.annotations.zip}",
211 ":framework-graphics{.public.annotations.zip}",
212 ":framework-media{.public.annotations.zip}",
213 ":framework-mediaprovider{.public.annotations.zip}",
214 ":framework-permission{.public.annotations.zip}",
215 ":framework-permission-s{.public.annotations.zip}",
216 ":framework-scheduling{.public.annotations.zip}",
217 ":framework-sdkextensions{.public.annotations.zip}",
218 ":framework-statsd{.public.annotations.zip}",
219 ":framework-tethering{.public.annotations.zip}",
220 ":framework-wifi{.public.annotations.zip}",
221 ],
222 out: ["annotations.zip"],
223 tools: [
224 "merge_annotation_zips",
225 "soong_zip",
226 ],
227 cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
228 "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
229}
230
Jiyong Park7fb4b182019-12-20 14:35:43 +0900231/////////////////////////////////////////////////////////////////////
232// API docs are created from the generated stub source files
233// using droiddoc
234/////////////////////////////////////////////////////////////////////
235
236framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
237 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
238 "-overview $(location core/java/overview.html) " +
239 // Federate Support Library references against local API file.
240 "-federate SupportLib https://developer.android.com " +
241 "-federationapi SupportLib $(location :current-support-api) " +
242 // Federate Support Library references against local API file.
243 "-federate AndroidX https://developer.android.com " +
244 "-federationapi AndroidX $(location :current-androidx-api) "
245
246doc_defaults {
247 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000248 libs: framework_docs_only_libs + [
249 "stub-annotations",
250 "unsupportedappusage",
251 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252 html_dirs: [
253 "docs/html",
254 ],
255 knowntags: [
256 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100257 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900258 ],
259 custom_template: "droiddoc-templates-sdk",
260 resourcesdir: "docs/html/reference/images/",
261 resourcesoutdir: "reference/android/images/",
262 hdf: [
263 "dac true",
264 "sdk.codename O",
265 "sdk.preview.version 1",
266 "sdk.version 7.0",
267 "sdk.rel.id 1",
268 "sdk.preview 0",
269 ],
270 arg_files: [
271 "core/res/AndroidManifest.xml",
272 "core/java/overview.html",
273 ":current-support-api",
274 ":current-androidx-api",
275 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700276 // TODO(b/169090544): remove below aidl includes.
277 aidl: {
278 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600279 include_dirs: [
280 "frameworks/av/aidl",
281 "frameworks/native/libs/permission/aidl",
282 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700283 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900284}
285
286doc_defaults {
287 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900288}
289
290droiddoc {
291 name: "doc-comment-check-docs",
292 defaults: ["framework-docs-default"],
293 srcs: [
294 ":framework-doc-stubs",
295 ],
296 args: framework_docs_only_args + " -referenceonly -parsecomments",
297 installable: false,
298}
299
300droiddoc {
301 name: "offline-sdk-docs",
302 defaults: ["framework-docs-default"],
303 srcs: [
304 ":framework-doc-stubs",
305 ],
306 hdf: [
307 "android.whichdoc offline",
308 ],
atrostb1ee27b2020-02-03 11:03:16 +0000309 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900310 proofread_file: "offline-sdk-docs-proofrerad.txt",
311 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
312 static_doc_index_redirect: "docs/docs-preview-index.html",
313}
314
315droiddoc {
316 // Please sync with android-api-council@ before making any changes for the name property below.
317 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
318 // See b/116221385 for reference.
319 name: "offline-sdk-referenceonly-docs",
320 defaults: ["framework-docs-default"],
321 srcs: [
322 ":framework-doc-stubs",
323 ],
324 hdf: [
325 "android.whichdoc offline",
326 ],
327 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
328 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
329 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
330 static_doc_properties: "docs/source.properties",
331}
332
333droiddoc {
334 // Please sync with android-api-council@ before making any changes for the name property below.
335 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
336 // See b/116221385 for reference.
337 name: "offline-system-sdk-referenceonly-docs",
338 defaults: ["framework-docs-default"],
339 srcs: [
340 ":framework-doc-system-stubs",
341 ],
342 hdf: [
343 "android.whichdoc offline",
344 ],
345 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
346 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
347 " -offlinemode -title \"Android System SDK\" -referenceonly",
348 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
349 static_doc_properties: "docs/source.properties",
350}
351
352droiddoc {
353 name: "online-sdk-docs",
354 defaults: ["framework-docs-default"],
355 srcs: [
356 ":framework-doc-stubs",
357 ],
358 hdf: [
359 "android.whichdoc online",
360 "android.hasSamples true",
361 ],
362 proofread_file: "online-sdk-docs-proofrerad.txt",
363 args: framework_docs_only_args +
364 " -toroot / -samplegroup Admin " +
365 " -samplegroup Background " +
366 " -samplegroup Connectivity " +
367 " -samplegroup Content " +
368 " -samplegroup Input " +
369 " -samplegroup Media " +
370 " -samplegroup Notification " +
371 " -samplegroup RenderScript " +
372 " -samplegroup Security " +
373 " -samplegroup Sensors " +
374 " -samplegroup System " +
375 " -samplegroup Testing " +
376 " -samplegroup UI " +
377 " -samplegroup Views " +
378 " -samplegroup Wearable -samplesdir development/samples/browseable ",
379}
380
381droiddoc {
382 name: "online-system-api-sdk-docs",
383 defaults: ["framework-docs-default"],
384 srcs: [
385 ":framework-doc-system-stubs",
386 ],
387 hdf: [
388 "android.whichdoc online",
389 "android.hasSamples true",
390 ],
391 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
392 args: framework_docs_only_args +
393 " -referenceonly " +
394 " -title \"Android SDK - Including system APIs.\" " +
395 " -hide 101 " +
396 " -hide 104 " +
397 " -hide 108 " +
398 " -toroot / -samplegroup Admin " +
399 " -samplegroup Background " +
400 " -samplegroup Connectivity " +
401 " -samplegroup Content " +
402 " -samplegroup Input " +
403 " -samplegroup Media " +
404 " -samplegroup Notification " +
405 " -samplegroup RenderScript " +
406 " -samplegroup Security " +
407 " -samplegroup Sensors " +
408 " -samplegroup System " +
409 " -samplegroup Testing " +
410 " -samplegroup UI " +
411 " -samplegroup Views " +
412 " -samplegroup Wearable -samplesdir development/samples/browseable ",
413 installable: false,
414}
415
416droiddoc {
417 name: "ds-docs-java",
418 defaults: ["framework-docs-default"],
419 srcs: [
420 ":framework-doc-stubs",
421 ],
422 hdf: [
423 "android.whichdoc online",
424 "android.hasSamples true",
425 ],
426 proofread_file: "ds-docs-proofrerad.txt",
427 args: framework_docs_only_args +
428 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
429 " -samplegroup Background " +
430 " -samplegroup Connectivity " +
431 " -samplegroup Content " +
432 " -samplegroup Input " +
433 " -samplegroup Media " +
434 " -samplegroup Notification " +
435 " -samplegroup RenderScript " +
436 " -samplegroup Security " +
437 " -samplegroup Sensors " +
438 " -samplegroup System " +
439 " -samplegroup Testing " +
440 " -samplegroup UI " +
441 " -samplegroup Views " +
442 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
443}
444
445droiddoc {
446 name: "ds-docs-kt",
447 defaults: ["framework-dokka-docs-default"],
448 srcs: [
449 ":framework-doc-stubs",
450 ],
451 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700452 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900453 proofread_file: "ds-dokka-proofread.txt",
454 dokka_enabled: true,
455}
456
457java_genrule {
458 name: "ds-docs",
459 tools: [
460 "zip2zip",
461 "merge_zips",
462 ],
463 srcs: [
464 ":ds-docs-java{.docs.zip}",
465 ":ds-docs-kt{.docs.zip}",
466 ],
467 out: ["ds-docs.zip"],
468 dist: {
469 targets: ["docs"],
470 },
471 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 -0700472 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900473}
474
475java_genrule {
476 name: "ds-docs-switched",
477 tools: [
478 "switcher4",
479 "soong_zip",
480 ],
481 srcs: [
482 ":ds-docs-java{.docs.zip}",
483 ":ds-docs-kt{.docs.zip}",
484 ],
485 out: ["ds-docs-switched.zip"],
486 dist: {
487 targets: ["docs"],
488 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800489 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700490 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
491 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
492 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
493 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900494}
495
496droiddoc {
497 name: "ds-static-docs",
498 defaults: ["framework-docs-default"],
499 srcs: [
500 ":framework-doc-stubs",
501 ],
502 hdf: [
503 "android.whichdoc online",
504 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900505 args: framework_docs_only_args +
506 " -staticonly " +
507 " -toroot / " +
508 " -devsite " +
509 " -ignoreJdLinks ",
510}
511
512droiddoc {
513 name: "ds-ref-navtree-docs",
514 defaults: ["framework-docs-default"],
515 srcs: [
516 ":framework-doc-stubs",
517 ],
518 hdf: [
519 "android.whichdoc online",
520 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900521 args: framework_docs_only_args +
522 " -toroot / " +
523 " -atLinksNavtree " +
524 " -navtreeonly ",
525}
526
527droiddoc {
528 name: "online-sdk-dev-docs",
529 defaults: ["framework-docs-default"],
530 srcs: [
531 ":framework-doc-stubs",
532 ],
533 hdf: [
534 "android.whichdoc online",
535 "android.hasSamples true",
536 ],
537 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
538 args: framework_docs_only_args +
539 " -toroot / -samplegroup Admin " +
540 " -samplegroup Background " +
541 " -samplegroup Connectivity " +
542 " -samplegroup Content " +
543 " -samplegroup Input " +
544 " -samplegroup Media " +
545 " -samplegroup Notification " +
546 " -samplegroup RenderScript " +
547 " -samplegroup Security " +
548 " -samplegroup Sensors " +
549 " -samplegroup System " +
550 " -samplegroup Testing " +
551 " -samplegroup UI " +
552 " -samplegroup Views " +
553 " -samplegroup Wearable -samplesdir development/samples/browseable ",
554}
555
556droiddoc {
557 name: "hidden-docs",
558 defaults: ["framework-docs-default"],
559 srcs: [
560 ":framework-doc-stubs",
561 ],
562 proofread_file: "hidden-docs-proofrerad.txt",
563 args: framework_docs_only_args +
564 " -referenceonly " +
565 " -title \"Android SDK - Including hidden APIs.\"",
566}