blob: c1816467146d41c9d5dd84d9974f5abffeb36765 [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
Jiyong Park7fb4b182019-12-20 14:35:43 +0900195/////////////////////////////////////////////////////////////////////
196// API docs are created from the generated stub source files
197// using droiddoc
198/////////////////////////////////////////////////////////////////////
199
200framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
201 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
202 "-overview $(location core/java/overview.html) " +
203 // Federate Support Library references against local API file.
204 "-federate SupportLib https://developer.android.com " +
205 "-federationapi SupportLib $(location :current-support-api) " +
206 // Federate Support Library references against local API file.
207 "-federate AndroidX https://developer.android.com " +
208 "-federationapi AndroidX $(location :current-androidx-api) "
209
210doc_defaults {
211 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000212 libs: framework_docs_only_libs + [
213 "stub-annotations",
214 "unsupportedappusage",
215 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900216 html_dirs: [
217 "docs/html",
218 ],
219 knowntags: [
220 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100221 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222 ],
223 custom_template: "droiddoc-templates-sdk",
224 resourcesdir: "docs/html/reference/images/",
225 resourcesoutdir: "reference/android/images/",
226 hdf: [
227 "dac true",
228 "sdk.codename O",
229 "sdk.preview.version 1",
230 "sdk.version 7.0",
231 "sdk.rel.id 1",
232 "sdk.preview 0",
233 ],
234 arg_files: [
235 "core/res/AndroidManifest.xml",
236 "core/java/overview.html",
237 ":current-support-api",
238 ":current-androidx-api",
239 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700240 // TODO(b/169090544): remove below aidl includes.
241 aidl: {
242 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600243 include_dirs: [
244 "frameworks/av/aidl",
245 "frameworks/native/libs/permission/aidl",
246 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700247 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900248}
249
250doc_defaults {
251 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252}
253
254droiddoc {
255 name: "doc-comment-check-docs",
256 defaults: ["framework-docs-default"],
257 srcs: [
258 ":framework-doc-stubs",
259 ],
260 args: framework_docs_only_args + " -referenceonly -parsecomments",
261 installable: false,
262}
263
264droiddoc {
265 name: "offline-sdk-docs",
266 defaults: ["framework-docs-default"],
267 srcs: [
268 ":framework-doc-stubs",
269 ],
270 hdf: [
271 "android.whichdoc offline",
272 ],
atrostb1ee27b2020-02-03 11:03:16 +0000273 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900274 proofread_file: "offline-sdk-docs-proofrerad.txt",
275 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
276 static_doc_index_redirect: "docs/docs-preview-index.html",
277}
278
279droiddoc {
280 // Please sync with android-api-council@ before making any changes for the name property below.
281 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
282 // See b/116221385 for reference.
283 name: "offline-sdk-referenceonly-docs",
284 defaults: ["framework-docs-default"],
285 srcs: [
286 ":framework-doc-stubs",
287 ],
288 hdf: [
289 "android.whichdoc offline",
290 ],
291 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
292 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
293 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
294 static_doc_properties: "docs/source.properties",
295}
296
297droiddoc {
298 // Please sync with android-api-council@ before making any changes for the name property below.
299 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
300 // See b/116221385 for reference.
301 name: "offline-system-sdk-referenceonly-docs",
302 defaults: ["framework-docs-default"],
303 srcs: [
304 ":framework-doc-system-stubs",
305 ],
306 hdf: [
307 "android.whichdoc offline",
308 ],
309 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
310 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
311 " -offlinemode -title \"Android System SDK\" -referenceonly",
312 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
313 static_doc_properties: "docs/source.properties",
314}
315
316droiddoc {
317 name: "online-sdk-docs",
318 defaults: ["framework-docs-default"],
319 srcs: [
320 ":framework-doc-stubs",
321 ],
322 hdf: [
323 "android.whichdoc online",
324 "android.hasSamples true",
325 ],
326 proofread_file: "online-sdk-docs-proofrerad.txt",
327 args: framework_docs_only_args +
328 " -toroot / -samplegroup Admin " +
329 " -samplegroup Background " +
330 " -samplegroup Connectivity " +
331 " -samplegroup Content " +
332 " -samplegroup Input " +
333 " -samplegroup Media " +
334 " -samplegroup Notification " +
335 " -samplegroup RenderScript " +
336 " -samplegroup Security " +
337 " -samplegroup Sensors " +
338 " -samplegroup System " +
339 " -samplegroup Testing " +
340 " -samplegroup UI " +
341 " -samplegroup Views " +
342 " -samplegroup Wearable -samplesdir development/samples/browseable ",
343}
344
345droiddoc {
346 name: "online-system-api-sdk-docs",
347 defaults: ["framework-docs-default"],
348 srcs: [
349 ":framework-doc-system-stubs",
350 ],
351 hdf: [
352 "android.whichdoc online",
353 "android.hasSamples true",
354 ],
355 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
356 args: framework_docs_only_args +
357 " -referenceonly " +
358 " -title \"Android SDK - Including system APIs.\" " +
359 " -hide 101 " +
360 " -hide 104 " +
361 " -hide 108 " +
362 " -toroot / -samplegroup Admin " +
363 " -samplegroup Background " +
364 " -samplegroup Connectivity " +
365 " -samplegroup Content " +
366 " -samplegroup Input " +
367 " -samplegroup Media " +
368 " -samplegroup Notification " +
369 " -samplegroup RenderScript " +
370 " -samplegroup Security " +
371 " -samplegroup Sensors " +
372 " -samplegroup System " +
373 " -samplegroup Testing " +
374 " -samplegroup UI " +
375 " -samplegroup Views " +
376 " -samplegroup Wearable -samplesdir development/samples/browseable ",
377 installable: false,
378}
379
380droiddoc {
381 name: "ds-docs-java",
382 defaults: ["framework-docs-default"],
383 srcs: [
384 ":framework-doc-stubs",
385 ],
386 hdf: [
387 "android.whichdoc online",
388 "android.hasSamples true",
389 ],
390 proofread_file: "ds-docs-proofrerad.txt",
391 args: framework_docs_only_args +
392 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
393 " -samplegroup Background " +
394 " -samplegroup Connectivity " +
395 " -samplegroup Content " +
396 " -samplegroup Input " +
397 " -samplegroup Media " +
398 " -samplegroup Notification " +
399 " -samplegroup RenderScript " +
400 " -samplegroup Security " +
401 " -samplegroup Sensors " +
402 " -samplegroup System " +
403 " -samplegroup Testing " +
404 " -samplegroup UI " +
405 " -samplegroup Views " +
406 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
407}
408
409droiddoc {
410 name: "ds-docs-kt",
411 defaults: ["framework-dokka-docs-default"],
412 srcs: [
413 ":framework-doc-stubs",
414 ],
415 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700416 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900417 proofread_file: "ds-dokka-proofread.txt",
418 dokka_enabled: true,
419}
420
421java_genrule {
422 name: "ds-docs",
423 tools: [
424 "zip2zip",
425 "merge_zips",
426 ],
427 srcs: [
428 ":ds-docs-java{.docs.zip}",
429 ":ds-docs-kt{.docs.zip}",
430 ],
431 out: ["ds-docs.zip"],
432 dist: {
433 targets: ["docs"],
434 },
435 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 -0700436 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900437}
438
439java_genrule {
440 name: "ds-docs-switched",
441 tools: [
442 "switcher4",
443 "soong_zip",
444 ],
445 srcs: [
446 ":ds-docs-java{.docs.zip}",
447 ":ds-docs-kt{.docs.zip}",
448 ],
449 out: ["ds-docs-switched.zip"],
450 dist: {
451 targets: ["docs"],
452 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800453 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700454 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
455 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
456 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
457 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900458}
459
460droiddoc {
461 name: "ds-static-docs",
462 defaults: ["framework-docs-default"],
463 srcs: [
464 ":framework-doc-stubs",
465 ],
466 hdf: [
467 "android.whichdoc online",
468 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900469 args: framework_docs_only_args +
470 " -staticonly " +
471 " -toroot / " +
472 " -devsite " +
473 " -ignoreJdLinks ",
474}
475
476droiddoc {
477 name: "ds-ref-navtree-docs",
478 defaults: ["framework-docs-default"],
479 srcs: [
480 ":framework-doc-stubs",
481 ],
482 hdf: [
483 "android.whichdoc online",
484 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900485 args: framework_docs_only_args +
486 " -toroot / " +
487 " -atLinksNavtree " +
488 " -navtreeonly ",
489}
490
491droiddoc {
492 name: "online-sdk-dev-docs",
493 defaults: ["framework-docs-default"],
494 srcs: [
495 ":framework-doc-stubs",
496 ],
497 hdf: [
498 "android.whichdoc online",
499 "android.hasSamples true",
500 ],
501 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
502 args: framework_docs_only_args +
503 " -toroot / -samplegroup Admin " +
504 " -samplegroup Background " +
505 " -samplegroup Connectivity " +
506 " -samplegroup Content " +
507 " -samplegroup Input " +
508 " -samplegroup Media " +
509 " -samplegroup Notification " +
510 " -samplegroup RenderScript " +
511 " -samplegroup Security " +
512 " -samplegroup Sensors " +
513 " -samplegroup System " +
514 " -samplegroup Testing " +
515 " -samplegroup UI " +
516 " -samplegroup Views " +
517 " -samplegroup Wearable -samplesdir development/samples/browseable ",
518}
519
520droiddoc {
521 name: "hidden-docs",
522 defaults: ["framework-docs-default"],
523 srcs: [
524 ":framework-doc-stubs",
525 ],
526 proofread_file: "hidden-docs-proofrerad.txt",
527 args: framework_docs_only_args +
528 " -referenceonly " +
529 " -title \"Android SDK - Including hidden APIs.\"",
530}