blob: 4a46a8222c27da3c86f9e4bf41f47cae3e7163cf [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.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100115stubs_defaults {
116 name: "framework-doc-stubs-sources-default",
117 defaults: ["framework-doc-stubs-default"],
118 srcs: [
119 ":framework-appsearch-sources",
120 ":framework-connectivity-sources",
121 ":framework-graphics-srcs",
122 ":framework-mediaprovider-sources",
123 ":framework-permission-sources",
124 ":framework-permission-s-sources",
125 ":framework-scheduling-sources",
126 ":framework-sdkextensions-sources",
127 ":framework-statsd-sources",
128 ":framework-tethering-srcs",
129 ":framework-wifi-updatable-sources",
130 ":ike-srcs",
131 ":updatable-media-srcs",
132 ],
133}
134
Jiyong Park7fb4b182019-12-20 14:35:43 +0900135droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100136 name: "android-non-updatable-doc-stubs",
137 defaults: ["android-non-updatable-doc-stubs-defaults"],
138 args: metalava_framework_docs_args,
139}
140
141droidstubs {
142 name: "android-non-updatable-doc-stubs-system",
143 defaults: ["android-non-updatable-doc-stubs-defaults"],
144 args: metalava_framework_docs_args +
145 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
146}
147
148droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900149 name: "framework-doc-system-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100150 defaults: ["framework-doc-stubs-sources-default"],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000151 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000152 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
satayevbc7c83e2021-06-29 22:27:06 +0100153 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900154}
155
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100156droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000157 name: "framework-doc-stubs",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100158 defaults: ["framework-doc-stubs-default"],
159 args: metalava_framework_docs_args,
160 srcs: [
161 ":android.net.ipsec.ike{.public.stubs.source}",
162 ":framework-appsearch{.public.stubs.source}",
163 ":framework-connectivity{.public.stubs.source}",
164 ":framework-graphics{.public.stubs.source}",
165 ":framework-media{.public.stubs.source}",
166 ":framework-mediaprovider{.public.stubs.source}",
167 ":framework-permission{.public.stubs.source}",
168 ":framework-permission-s{.public.stubs.source}",
169 ":framework-scheduling{.public.stubs.source}",
170 ":framework-sdkextensions{.public.stubs.source}",
171 ":framework-statsd{.public.stubs.source}",
172 ":framework-tethering{.public.stubs.source}",
173 ":framework-wifi{.public.stubs.source}",
174 ],
175 aidl: {
176 local_include_dirs: [
177 "apex/media/aidl/stable",
178 ],
179 include_dirs: [
180 "packages/modules/Connectivity/framework/aidl-export",
181 ],
182 },
183}
184
Jiyong Park7fb4b182019-12-20 14:35:43 +0900185/////////////////////////////////////////////////////////////////////
186// API docs are created from the generated stub source files
187// using droiddoc
188/////////////////////////////////////////////////////////////////////
189
190framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
191 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
192 "-overview $(location core/java/overview.html) " +
193 // Federate Support Library references against local API file.
194 "-federate SupportLib https://developer.android.com " +
195 "-federationapi SupportLib $(location :current-support-api) " +
196 // Federate Support Library references against local API file.
197 "-federate AndroidX https://developer.android.com " +
198 "-federationapi AndroidX $(location :current-androidx-api) "
199
200doc_defaults {
201 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000202 libs: framework_docs_only_libs + [
203 "stub-annotations",
204 "unsupportedappusage",
205 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900206 html_dirs: [
207 "docs/html",
208 ],
209 knowntags: [
210 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100211 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900212 ],
213 custom_template: "droiddoc-templates-sdk",
214 resourcesdir: "docs/html/reference/images/",
215 resourcesoutdir: "reference/android/images/",
216 hdf: [
217 "dac true",
218 "sdk.codename O",
219 "sdk.preview.version 1",
220 "sdk.version 7.0",
221 "sdk.rel.id 1",
222 "sdk.preview 0",
223 ],
224 arg_files: [
225 "core/res/AndroidManifest.xml",
226 "core/java/overview.html",
227 ":current-support-api",
228 ":current-androidx-api",
229 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700230 // TODO(b/169090544): remove below aidl includes.
231 aidl: {
232 local_include_dirs: ["media/aidl"],
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600233 include_dirs: [
234 "frameworks/av/aidl",
235 "frameworks/native/libs/permission/aidl",
236 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700237 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238}
239
240doc_defaults {
241 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900242}
243
244droiddoc {
245 name: "doc-comment-check-docs",
246 defaults: ["framework-docs-default"],
247 srcs: [
248 ":framework-doc-stubs",
249 ],
250 args: framework_docs_only_args + " -referenceonly -parsecomments",
251 installable: false,
252}
253
254droiddoc {
255 name: "offline-sdk-docs",
256 defaults: ["framework-docs-default"],
257 srcs: [
258 ":framework-doc-stubs",
259 ],
260 hdf: [
261 "android.whichdoc offline",
262 ],
atrostb1ee27b2020-02-03 11:03:16 +0000263 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900264 proofread_file: "offline-sdk-docs-proofrerad.txt",
265 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
266 static_doc_index_redirect: "docs/docs-preview-index.html",
267}
268
269droiddoc {
270 // Please sync with android-api-council@ before making any changes for the name property below.
271 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
272 // See b/116221385 for reference.
273 name: "offline-sdk-referenceonly-docs",
274 defaults: ["framework-docs-default"],
275 srcs: [
276 ":framework-doc-stubs",
277 ],
278 hdf: [
279 "android.whichdoc offline",
280 ],
281 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
282 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
283 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
284 static_doc_properties: "docs/source.properties",
285}
286
287droiddoc {
288 // Please sync with android-api-council@ before making any changes for the name property below.
289 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
290 // See b/116221385 for reference.
291 name: "offline-system-sdk-referenceonly-docs",
292 defaults: ["framework-docs-default"],
293 srcs: [
294 ":framework-doc-system-stubs",
295 ],
296 hdf: [
297 "android.whichdoc offline",
298 ],
299 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
300 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
301 " -offlinemode -title \"Android System SDK\" -referenceonly",
302 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
303 static_doc_properties: "docs/source.properties",
304}
305
306droiddoc {
307 name: "online-sdk-docs",
308 defaults: ["framework-docs-default"],
309 srcs: [
310 ":framework-doc-stubs",
311 ],
312 hdf: [
313 "android.whichdoc online",
314 "android.hasSamples true",
315 ],
316 proofread_file: "online-sdk-docs-proofrerad.txt",
317 args: framework_docs_only_args +
318 " -toroot / -samplegroup Admin " +
319 " -samplegroup Background " +
320 " -samplegroup Connectivity " +
321 " -samplegroup Content " +
322 " -samplegroup Input " +
323 " -samplegroup Media " +
324 " -samplegroup Notification " +
325 " -samplegroup RenderScript " +
326 " -samplegroup Security " +
327 " -samplegroup Sensors " +
328 " -samplegroup System " +
329 " -samplegroup Testing " +
330 " -samplegroup UI " +
331 " -samplegroup Views " +
332 " -samplegroup Wearable -samplesdir development/samples/browseable ",
333}
334
335droiddoc {
336 name: "online-system-api-sdk-docs",
337 defaults: ["framework-docs-default"],
338 srcs: [
339 ":framework-doc-system-stubs",
340 ],
341 hdf: [
342 "android.whichdoc online",
343 "android.hasSamples true",
344 ],
345 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
346 args: framework_docs_only_args +
347 " -referenceonly " +
348 " -title \"Android SDK - Including system APIs.\" " +
349 " -hide 101 " +
350 " -hide 104 " +
351 " -hide 108 " +
352 " -toroot / -samplegroup Admin " +
353 " -samplegroup Background " +
354 " -samplegroup Connectivity " +
355 " -samplegroup Content " +
356 " -samplegroup Input " +
357 " -samplegroup Media " +
358 " -samplegroup Notification " +
359 " -samplegroup RenderScript " +
360 " -samplegroup Security " +
361 " -samplegroup Sensors " +
362 " -samplegroup System " +
363 " -samplegroup Testing " +
364 " -samplegroup UI " +
365 " -samplegroup Views " +
366 " -samplegroup Wearable -samplesdir development/samples/browseable ",
367 installable: false,
368}
369
370droiddoc {
371 name: "ds-docs-java",
372 defaults: ["framework-docs-default"],
373 srcs: [
374 ":framework-doc-stubs",
375 ],
376 hdf: [
377 "android.whichdoc online",
378 "android.hasSamples true",
379 ],
380 proofread_file: "ds-docs-proofrerad.txt",
381 args: framework_docs_only_args +
382 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
383 " -samplegroup Background " +
384 " -samplegroup Connectivity " +
385 " -samplegroup Content " +
386 " -samplegroup Input " +
387 " -samplegroup Media " +
388 " -samplegroup Notification " +
389 " -samplegroup RenderScript " +
390 " -samplegroup Security " +
391 " -samplegroup Sensors " +
392 " -samplegroup System " +
393 " -samplegroup Testing " +
394 " -samplegroup UI " +
395 " -samplegroup Views " +
396 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
397}
398
399droiddoc {
400 name: "ds-docs-kt",
401 defaults: ["framework-dokka-docs-default"],
402 srcs: [
403 ":framework-doc-stubs",
404 ],
405 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700406 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900407 proofread_file: "ds-dokka-proofread.txt",
408 dokka_enabled: true,
409}
410
411java_genrule {
412 name: "ds-docs",
413 tools: [
414 "zip2zip",
415 "merge_zips",
416 ],
417 srcs: [
418 ":ds-docs-java{.docs.zip}",
419 ":ds-docs-kt{.docs.zip}",
420 ],
421 out: ["ds-docs.zip"],
422 dist: {
423 targets: ["docs"],
424 },
425 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 -0700426 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900427}
428
429java_genrule {
430 name: "ds-docs-switched",
431 tools: [
432 "switcher4",
433 "soong_zip",
434 ],
435 srcs: [
436 ":ds-docs-java{.docs.zip}",
437 ":ds-docs-kt{.docs.zip}",
438 ],
439 out: ["ds-docs-switched.zip"],
440 dist: {
441 targets: ["docs"],
442 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800443 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700444 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
445 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
446 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
447 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900448}
449
450droiddoc {
451 name: "ds-static-docs",
452 defaults: ["framework-docs-default"],
453 srcs: [
454 ":framework-doc-stubs",
455 ],
456 hdf: [
457 "android.whichdoc online",
458 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900459 args: framework_docs_only_args +
460 " -staticonly " +
461 " -toroot / " +
462 " -devsite " +
463 " -ignoreJdLinks ",
464}
465
466droiddoc {
467 name: "ds-ref-navtree-docs",
468 defaults: ["framework-docs-default"],
469 srcs: [
470 ":framework-doc-stubs",
471 ],
472 hdf: [
473 "android.whichdoc online",
474 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900475 args: framework_docs_only_args +
476 " -toroot / " +
477 " -atLinksNavtree " +
478 " -navtreeonly ",
479}
480
481droiddoc {
482 name: "online-sdk-dev-docs",
483 defaults: ["framework-docs-default"],
484 srcs: [
485 ":framework-doc-stubs",
486 ],
487 hdf: [
488 "android.whichdoc online",
489 "android.hasSamples true",
490 ],
491 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
492 args: framework_docs_only_args +
493 " -toroot / -samplegroup Admin " +
494 " -samplegroup Background " +
495 " -samplegroup Connectivity " +
496 " -samplegroup Content " +
497 " -samplegroup Input " +
498 " -samplegroup Media " +
499 " -samplegroup Notification " +
500 " -samplegroup RenderScript " +
501 " -samplegroup Security " +
502 " -samplegroup Sensors " +
503 " -samplegroup System " +
504 " -samplegroup Testing " +
505 " -samplegroup UI " +
506 " -samplegroup Views " +
507 " -samplegroup Wearable -samplesdir development/samples/browseable ",
508}
509
510droiddoc {
511 name: "hidden-docs",
512 defaults: ["framework-docs-default"],
513 srcs: [
514 ":framework-doc-stubs",
515 ],
516 proofread_file: "hidden-docs-proofrerad.txt",
517 args: framework_docs_only_args +
518 " -referenceonly " +
519 " -title \"Android SDK - Including hidden APIs.\"",
520}