blob: 39f055b578ab75e1a4da38cf5002887d892674d2 [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: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100143 include_dirs: [
144 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddin235f9b12022-02-15 23:25:53 +0000145 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100146 ],
147 },
148}
149
Jiyong Park7fb4b182019-12-20 14:35:43 +0900150/////////////////////////////////////////////////////////////////////
151// API docs are created from the generated stub source files
152// using droiddoc
153/////////////////////////////////////////////////////////////////////
154
155framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
156 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
157 "-overview $(location core/java/overview.html) " +
158 // Federate Support Library references against local API file.
159 "-federate SupportLib https://developer.android.com " +
160 "-federationapi SupportLib $(location :current-support-api) " +
161 // Federate Support Library references against local API file.
162 "-federate AndroidX https://developer.android.com " +
163 "-federationapi AndroidX $(location :current-androidx-api) "
164
165doc_defaults {
166 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000167 libs: framework_docs_only_libs + [
168 "stub-annotations",
169 "unsupportedappusage",
170 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900171 html_dirs: [
172 "docs/html",
173 ],
174 knowntags: [
175 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100176 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900177 ],
178 custom_template: "droiddoc-templates-sdk",
179 resourcesdir: "docs/html/reference/images/",
180 resourcesoutdir: "reference/android/images/",
181 hdf: [
182 "dac true",
183 "sdk.codename O",
184 "sdk.preview.version 1",
185 "sdk.version 7.0",
186 "sdk.rel.id 1",
187 "sdk.preview 0",
188 ],
189 arg_files: [
190 "core/res/AndroidManifest.xml",
191 "core/java/overview.html",
192 ":current-support-api",
193 ":current-androidx-api",
194 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700195 // TODO(b/169090544): remove below aidl includes.
196 aidl: {
197 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600198 include_dirs: [
199 "frameworks/av/aidl",
200 "frameworks/native/libs/permission/aidl",
201 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700202 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900203}
204
205doc_defaults {
206 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900207}
208
209droiddoc {
210 name: "doc-comment-check-docs",
211 defaults: ["framework-docs-default"],
212 srcs: [
213 ":framework-doc-stubs",
214 ],
215 args: framework_docs_only_args + " -referenceonly -parsecomments",
216 installable: false,
217}
218
219droiddoc {
220 name: "offline-sdk-docs",
221 defaults: ["framework-docs-default"],
222 srcs: [
223 ":framework-doc-stubs",
224 ],
225 hdf: [
226 "android.whichdoc offline",
227 ],
atrostb1ee27b2020-02-03 11:03:16 +0000228 compat_config: ":global-compat-config",
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000229 proofread_file: "offline-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900230 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
231 static_doc_index_redirect: "docs/docs-preview-index.html",
232}
233
234droiddoc {
235 // Please sync with android-api-council@ before making any changes for the name property below.
236 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
237 // See b/116221385 for reference.
238 name: "offline-sdk-referenceonly-docs",
239 defaults: ["framework-docs-default"],
240 srcs: [
241 ":framework-doc-stubs",
242 ],
243 hdf: [
244 "android.whichdoc offline",
245 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000246 proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900247 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
248 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
249 static_doc_properties: "docs/source.properties",
250}
251
252droiddoc {
253 // Please sync with android-api-council@ before making any changes for the name property below.
254 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
255 // See b/116221385 for reference.
256 name: "offline-system-sdk-referenceonly-docs",
257 defaults: ["framework-docs-default"],
258 srcs: [
259 ":framework-doc-system-stubs",
260 ],
261 hdf: [
262 "android.whichdoc offline",
263 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000264 proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900265 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
266 " -offlinemode -title \"Android System SDK\" -referenceonly",
267 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
268 static_doc_properties: "docs/source.properties",
269}
270
271droiddoc {
272 name: "online-sdk-docs",
273 defaults: ["framework-docs-default"],
274 srcs: [
275 ":framework-doc-stubs",
276 ],
277 hdf: [
278 "android.whichdoc online",
279 "android.hasSamples true",
280 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000281 proofread_file: "online-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900282 args: framework_docs_only_args +
283 " -toroot / -samplegroup Admin " +
284 " -samplegroup Background " +
285 " -samplegroup Connectivity " +
286 " -samplegroup Content " +
287 " -samplegroup Input " +
288 " -samplegroup Media " +
289 " -samplegroup Notification " +
290 " -samplegroup RenderScript " +
291 " -samplegroup Security " +
292 " -samplegroup Sensors " +
293 " -samplegroup System " +
294 " -samplegroup Testing " +
295 " -samplegroup UI " +
296 " -samplegroup Views " +
297 " -samplegroup Wearable -samplesdir development/samples/browseable ",
298}
299
300droiddoc {
301 name: "online-system-api-sdk-docs",
302 defaults: ["framework-docs-default"],
303 srcs: [
304 ":framework-doc-system-stubs",
305 ],
306 hdf: [
307 "android.whichdoc online",
308 "android.hasSamples true",
309 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000310 proofread_file: "online-system-api-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900311 args: framework_docs_only_args +
312 " -referenceonly " +
313 " -title \"Android SDK - Including system APIs.\" " +
314 " -hide 101 " +
315 " -hide 104 " +
316 " -hide 108 " +
317 " -toroot / -samplegroup Admin " +
318 " -samplegroup Background " +
319 " -samplegroup Connectivity " +
320 " -samplegroup Content " +
321 " -samplegroup Input " +
322 " -samplegroup Media " +
323 " -samplegroup Notification " +
324 " -samplegroup RenderScript " +
325 " -samplegroup Security " +
326 " -samplegroup Sensors " +
327 " -samplegroup System " +
328 " -samplegroup Testing " +
329 " -samplegroup UI " +
330 " -samplegroup Views " +
331 " -samplegroup Wearable -samplesdir development/samples/browseable ",
332 installable: false,
333}
334
335droiddoc {
336 name: "ds-docs-java",
337 defaults: ["framework-docs-default"],
338 srcs: [
339 ":framework-doc-stubs",
340 ],
341 hdf: [
342 "android.whichdoc online",
343 "android.hasSamples true",
344 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000345 proofread_file: "ds-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900346 args: framework_docs_only_args +
347 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
348 " -samplegroup Background " +
349 " -samplegroup Connectivity " +
350 " -samplegroup Content " +
351 " -samplegroup Input " +
352 " -samplegroup Media " +
353 " -samplegroup Notification " +
354 " -samplegroup RenderScript " +
355 " -samplegroup Security " +
356 " -samplegroup Sensors " +
357 " -samplegroup System " +
358 " -samplegroup Testing " +
359 " -samplegroup UI " +
360 " -samplegroup Views " +
361 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
362}
363
364droiddoc {
365 name: "ds-docs-kt",
366 defaults: ["framework-dokka-docs-default"],
367 srcs: [
368 ":framework-doc-stubs",
369 ],
370 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700371 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900372 proofread_file: "ds-dokka-proofread.txt",
373 dokka_enabled: true,
374}
375
376java_genrule {
377 name: "ds-docs",
378 tools: [
379 "zip2zip",
380 "merge_zips",
381 ],
382 srcs: [
383 ":ds-docs-java{.docs.zip}",
384 ":ds-docs-kt{.docs.zip}",
385 ],
386 out: ["ds-docs.zip"],
387 dist: {
388 targets: ["docs"],
389 },
390 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 -0700391 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900392}
393
394java_genrule {
395 name: "ds-docs-switched",
396 tools: [
397 "switcher4",
398 "soong_zip",
399 ],
400 srcs: [
401 ":ds-docs-java{.docs.zip}",
402 ":ds-docs-kt{.docs.zip}",
403 ],
404 out: ["ds-docs-switched.zip"],
405 dist: {
406 targets: ["docs"],
407 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800408 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700409 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
410 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
411 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
412 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900413}
414
415droiddoc {
416 name: "ds-static-docs",
417 defaults: ["framework-docs-default"],
418 srcs: [
419 ":framework-doc-stubs",
420 ],
421 hdf: [
422 "android.whichdoc online",
423 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900424 args: framework_docs_only_args +
425 " -staticonly " +
426 " -toroot / " +
427 " -devsite " +
428 " -ignoreJdLinks ",
429}
430
431droiddoc {
432 name: "ds-ref-navtree-docs",
433 defaults: ["framework-docs-default"],
434 srcs: [
435 ":framework-doc-stubs",
436 ],
437 hdf: [
438 "android.whichdoc online",
439 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900440 args: framework_docs_only_args +
441 " -toroot / " +
442 " -atLinksNavtree " +
443 " -navtreeonly ",
444}
445
446droiddoc {
447 name: "online-sdk-dev-docs",
448 defaults: ["framework-docs-default"],
449 srcs: [
450 ":framework-doc-stubs",
451 ],
452 hdf: [
453 "android.whichdoc online",
454 "android.hasSamples true",
455 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000456 proofread_file: "online-sdk-dev-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900457 args: framework_docs_only_args +
458 " -toroot / -samplegroup Admin " +
459 " -samplegroup Background " +
460 " -samplegroup Connectivity " +
461 " -samplegroup Content " +
462 " -samplegroup Input " +
463 " -samplegroup Media " +
464 " -samplegroup Notification " +
465 " -samplegroup RenderScript " +
466 " -samplegroup Security " +
467 " -samplegroup Sensors " +
468 " -samplegroup System " +
469 " -samplegroup Testing " +
470 " -samplegroup UI " +
471 " -samplegroup Views " +
472 " -samplegroup Wearable -samplesdir development/samples/browseable ",
473}
474
475droiddoc {
476 name: "hidden-docs",
477 defaults: ["framework-docs-default"],
478 srcs: [
479 ":framework-doc-stubs",
480 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000481 proofread_file: "hidden-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900482 args: framework_docs_only_args +
483 " -referenceonly " +
484 " -title \"Android SDK - Including hidden APIs.\"",
485}