blob: 5b7c125ed46b1f2ab4d53089dd706df9bbfae3eb [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 Hanssonecf9fc32022-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
Neha Pattanfa46dd22022-02-18 19:46:09 +000082 ":framework-adservices-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010083 ":framework-appsearch-sources",
Frank Wang07861f72022-01-25 18:41:45 +000084 ":framework-auxiliary-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010085 ":framework-connectivity-sources",
Roopa Sattiraju8e305772022-01-20 10:05:19 -080086 ":framework-bluetooth-sources",
paulhuf45fe962021-12-14 23:09:55 +080087 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010088 ":framework-graphics-srcs",
89 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -070090 ":framework-nearby-sources",
Frank Wange97ff9e2022-02-13 07:06:31 +000091 ":framework-ondevicepersonalization-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010092 ":framework-permission-sources",
93 ":framework-permission-s-sources",
94 ":framework-scheduling-sources",
95 ":framework-sdkextensions-sources",
96 ":framework-statsd-sources",
Gavin Corkerybc006442021-11-16 22:33:10 +000097 ":framework-supplementalprocess-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010098 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -070099 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100100 ":framework-wifi-updatable-sources",
101 ":ike-srcs",
102 ":updatable-media-srcs",
103 ],
104}
105
Jiyong Park7fb4b182019-12-20 14:35:43 +0900106droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100107 name: "android-non-updatable-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000108 defaults: [
109 "android-non-updatable-doc-stubs-defaults",
110 "module-classpath-stubs-defaults",
111 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100112 args: metalava_framework_docs_args,
113}
114
115droidstubs {
116 name: "android-non-updatable-doc-stubs-system",
Anton Hansson5aa59332022-01-21 16:32:31 +0000117 defaults: [
118 "android-non-updatable-doc-stubs-defaults",
119 "module-classpath-stubs-defaults",
120 ],
Anton Hansson867f94c2021-05-05 10:32:31 +0100121 args: metalava_framework_docs_args +
122 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
123}
124
125droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900126 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100127 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000128 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000129 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Anton Hansson5aa59332022-01-21 16:32:31 +0000130 api_levels_annotations_enabled: true,
131 api_levels_annotations_dirs: [
132 "sdk-dir",
133 "api-versions-jars-dir",
134 ],
satayevbc7c83e2021-06-29 22:27:06 +0100135 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900136}
137
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100138droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000139 name: "framework-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000140 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonecf9fc32022-01-14 12:10:01 +0000141 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100142 args: metalava_framework_docs_args,
Anton Hansson5aa59332022-01-21 16:32:31 +0000143 api_levels_annotations_enabled: true,
144 api_levels_annotations_dirs: [
145 "sdk-dir",
146 "api-versions-jars-dir",
147 ],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100148 aidl: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100149 include_dirs: [
150 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddinb8b46fd2022-02-11 14:20:10 +0000151 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100152 ],
153 },
154}
155
Jiyong Park7fb4b182019-12-20 14:35:43 +0900156/////////////////////////////////////////////////////////////////////
157// API docs are created from the generated stub source files
158// using droiddoc
159/////////////////////////////////////////////////////////////////////
160
161framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
162 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
163 "-overview $(location core/java/overview.html) " +
164 // Federate Support Library references against local API file.
165 "-federate SupportLib https://developer.android.com " +
166 "-federationapi SupportLib $(location :current-support-api) " +
167 // Federate Support Library references against local API file.
168 "-federate AndroidX https://developer.android.com " +
169 "-federationapi AndroidX $(location :current-androidx-api) "
170
171doc_defaults {
172 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000173 libs: framework_docs_only_libs + [
174 "stub-annotations",
175 "unsupportedappusage",
176 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900177 html_dirs: [
178 "docs/html",
179 ],
180 knowntags: [
181 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100182 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900183 ],
184 custom_template: "droiddoc-templates-sdk",
185 resourcesdir: "docs/html/reference/images/",
186 resourcesoutdir: "reference/android/images/",
187 hdf: [
188 "dac true",
189 "sdk.codename O",
190 "sdk.preview.version 1",
191 "sdk.version 7.0",
192 "sdk.rel.id 1",
193 "sdk.preview 0",
194 ],
195 arg_files: [
196 "core/res/AndroidManifest.xml",
197 "core/java/overview.html",
198 ":current-support-api",
199 ":current-androidx-api",
200 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700201 // TODO(b/169090544): remove below aidl includes.
202 aidl: {
203 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600204 include_dirs: [
205 "frameworks/av/aidl",
206 "frameworks/native/libs/permission/aidl",
207 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700208 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900209}
210
211doc_defaults {
212 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900213}
214
215droiddoc {
216 name: "doc-comment-check-docs",
217 defaults: ["framework-docs-default"],
218 srcs: [
219 ":framework-doc-stubs",
220 ],
221 args: framework_docs_only_args + " -referenceonly -parsecomments",
222 installable: false,
223}
224
225droiddoc {
226 name: "offline-sdk-docs",
227 defaults: ["framework-docs-default"],
228 srcs: [
229 ":framework-doc-stubs",
230 ],
231 hdf: [
232 "android.whichdoc offline",
233 ],
atrostb1ee27b2020-02-03 11:03:16 +0000234 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900235 proofread_file: "offline-sdk-docs-proofrerad.txt",
236 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
237 static_doc_index_redirect: "docs/docs-preview-index.html",
238}
239
240droiddoc {
241 // Please sync with android-api-council@ before making any changes for the name property below.
242 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
243 // See b/116221385 for reference.
244 name: "offline-sdk-referenceonly-docs",
245 defaults: ["framework-docs-default"],
246 srcs: [
247 ":framework-doc-stubs",
248 ],
249 hdf: [
250 "android.whichdoc offline",
251 ],
252 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
253 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
254 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
255 static_doc_properties: "docs/source.properties",
256}
257
258droiddoc {
259 // Please sync with android-api-council@ before making any changes for the name property below.
260 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
261 // See b/116221385 for reference.
262 name: "offline-system-sdk-referenceonly-docs",
263 defaults: ["framework-docs-default"],
264 srcs: [
265 ":framework-doc-system-stubs",
266 ],
267 hdf: [
268 "android.whichdoc offline",
269 ],
270 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
271 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
272 " -offlinemode -title \"Android System SDK\" -referenceonly",
273 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
274 static_doc_properties: "docs/source.properties",
275}
276
277droiddoc {
278 name: "online-sdk-docs",
279 defaults: ["framework-docs-default"],
280 srcs: [
281 ":framework-doc-stubs",
282 ],
283 hdf: [
284 "android.whichdoc online",
285 "android.hasSamples true",
286 ],
287 proofread_file: "online-sdk-docs-proofrerad.txt",
288 args: framework_docs_only_args +
289 " -toroot / -samplegroup Admin " +
290 " -samplegroup Background " +
291 " -samplegroup Connectivity " +
292 " -samplegroup Content " +
293 " -samplegroup Input " +
294 " -samplegroup Media " +
295 " -samplegroup Notification " +
296 " -samplegroup RenderScript " +
297 " -samplegroup Security " +
298 " -samplegroup Sensors " +
299 " -samplegroup System " +
300 " -samplegroup Testing " +
301 " -samplegroup UI " +
302 " -samplegroup Views " +
303 " -samplegroup Wearable -samplesdir development/samples/browseable ",
304}
305
306droiddoc {
307 name: "online-system-api-sdk-docs",
308 defaults: ["framework-docs-default"],
309 srcs: [
310 ":framework-doc-system-stubs",
311 ],
312 hdf: [
313 "android.whichdoc online",
314 "android.hasSamples true",
315 ],
316 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
317 args: framework_docs_only_args +
318 " -referenceonly " +
319 " -title \"Android SDK - Including system APIs.\" " +
320 " -hide 101 " +
321 " -hide 104 " +
322 " -hide 108 " +
323 " -toroot / -samplegroup Admin " +
324 " -samplegroup Background " +
325 " -samplegroup Connectivity " +
326 " -samplegroup Content " +
327 " -samplegroup Input " +
328 " -samplegroup Media " +
329 " -samplegroup Notification " +
330 " -samplegroup RenderScript " +
331 " -samplegroup Security " +
332 " -samplegroup Sensors " +
333 " -samplegroup System " +
334 " -samplegroup Testing " +
335 " -samplegroup UI " +
336 " -samplegroup Views " +
337 " -samplegroup Wearable -samplesdir development/samples/browseable ",
338 installable: false,
339}
340
341droiddoc {
342 name: "ds-docs-java",
343 defaults: ["framework-docs-default"],
344 srcs: [
345 ":framework-doc-stubs",
346 ],
347 hdf: [
348 "android.whichdoc online",
349 "android.hasSamples true",
350 ],
351 proofread_file: "ds-docs-proofrerad.txt",
352 args: framework_docs_only_args +
353 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
354 " -samplegroup Background " +
355 " -samplegroup Connectivity " +
356 " -samplegroup Content " +
357 " -samplegroup Input " +
358 " -samplegroup Media " +
359 " -samplegroup Notification " +
360 " -samplegroup RenderScript " +
361 " -samplegroup Security " +
362 " -samplegroup Sensors " +
363 " -samplegroup System " +
364 " -samplegroup Testing " +
365 " -samplegroup UI " +
366 " -samplegroup Views " +
367 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
368}
369
370droiddoc {
371 name: "ds-docs-kt",
372 defaults: ["framework-dokka-docs-default"],
373 srcs: [
374 ":framework-doc-stubs",
375 ],
376 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700377 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900378 proofread_file: "ds-dokka-proofread.txt",
379 dokka_enabled: true,
380}
381
382java_genrule {
383 name: "ds-docs",
384 tools: [
385 "zip2zip",
386 "merge_zips",
387 ],
388 srcs: [
389 ":ds-docs-java{.docs.zip}",
390 ":ds-docs-kt{.docs.zip}",
391 ],
392 out: ["ds-docs.zip"],
393 dist: {
394 targets: ["docs"],
395 },
396 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 -0700397 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900398}
399
400java_genrule {
401 name: "ds-docs-switched",
402 tools: [
403 "switcher4",
404 "soong_zip",
405 ],
406 srcs: [
407 ":ds-docs-java{.docs.zip}",
408 ":ds-docs-kt{.docs.zip}",
409 ],
410 out: ["ds-docs-switched.zip"],
411 dist: {
412 targets: ["docs"],
413 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800414 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700415 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
416 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
417 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
418 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900419}
420
421droiddoc {
422 name: "ds-static-docs",
423 defaults: ["framework-docs-default"],
424 srcs: [
425 ":framework-doc-stubs",
426 ],
427 hdf: [
428 "android.whichdoc online",
429 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900430 args: framework_docs_only_args +
431 " -staticonly " +
432 " -toroot / " +
433 " -devsite " +
434 " -ignoreJdLinks ",
435}
436
437droiddoc {
438 name: "ds-ref-navtree-docs",
439 defaults: ["framework-docs-default"],
440 srcs: [
441 ":framework-doc-stubs",
442 ],
443 hdf: [
444 "android.whichdoc online",
445 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900446 args: framework_docs_only_args +
447 " -toroot / " +
448 " -atLinksNavtree " +
449 " -navtreeonly ",
450}
451
452droiddoc {
453 name: "online-sdk-dev-docs",
454 defaults: ["framework-docs-default"],
455 srcs: [
456 ":framework-doc-stubs",
457 ],
458 hdf: [
459 "android.whichdoc online",
460 "android.hasSamples true",
461 ],
462 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
463 args: framework_docs_only_args +
464 " -toroot / -samplegroup Admin " +
465 " -samplegroup Background " +
466 " -samplegroup Connectivity " +
467 " -samplegroup Content " +
468 " -samplegroup Input " +
469 " -samplegroup Media " +
470 " -samplegroup Notification " +
471 " -samplegroup RenderScript " +
472 " -samplegroup Security " +
473 " -samplegroup Sensors " +
474 " -samplegroup System " +
475 " -samplegroup Testing " +
476 " -samplegroup UI " +
477 " -samplegroup Views " +
478 " -samplegroup Wearable -samplesdir development/samples/browseable ",
479}
480
481droiddoc {
482 name: "hidden-docs",
483 defaults: ["framework-docs-default"],
484 srcs: [
485 ":framework-doc-stubs",
486 ],
487 proofread_file: "hidden-docs-proofrerad.txt",
488 args: framework_docs_only_args +
489 " -referenceonly " +
490 " -title \"Android SDK - Including hidden APIs.\"",
491}