blob: 8cfc0247b8c4dda87954c10b954cdfba0ecb511e [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}",
Anton Hansson35c0b092021-03-30 10:46:48 +010080 ":framework-appsearch-sources",
81 ":framework-connectivity-sources",
82 ":framework-graphics-srcs",
83 ":framework-mediaprovider-sources",
84 ":framework-permission-sources",
85 ":framework-permission-s-sources",
86 ":framework-scheduling-sources",
87 ":framework-sdkextensions-sources",
88 ":framework-statsd-sources",
89 ":framework-tethering-srcs",
90 ":framework-wifi-updatable-sources",
Paul Duffin5a4e8f22020-11-25 15:45:43 +000091 ":i18n.module.public.api{.public.stubs.source}",
Anton Hansson35c0b092021-03-30 10:46:48 +010092 ":ike-srcs",
93 ":updatable-media-srcs",
94
95 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010096 ":android-test-base-sources",
97 ":android-test-mock-sources",
98 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090099 ],
100 libs: framework_docs_only_libs,
101 create_doc_stubs: true,
102 annotations_enabled: true,
Anton Hansson76ac4cc2021-05-05 19:22:52 +0100103 filter_packages: packages_to_document,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900104 api_levels_annotations_enabled: true,
105 api_levels_annotations_dirs: [
106 "sdk-dir",
107 "api-versions-jars-dir",
108 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100109 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900110 merge_annotations_dirs: [
111 "metalava-manual",
112 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700113 // TODO(b/169090544): remove below aidl includes.
114 aidl: {
115 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -0700116 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700117 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900118}
119
120droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +0100121 name: "android-non-updatable-doc-stubs",
122 defaults: ["android-non-updatable-doc-stubs-defaults"],
123 args: metalava_framework_docs_args,
124}
125
126droidstubs {
127 name: "android-non-updatable-doc-stubs-system",
128 defaults: ["android-non-updatable-doc-stubs-defaults"],
129 args: metalava_framework_docs_args +
130 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
131}
132
133droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900134 name: "framework-doc-stubs",
135 defaults: ["framework-doc-stubs-default"],
136 arg_files: [
137 "core/res/AndroidManifest.xml",
138 ],
Anton Hansson26c843f2021-05-05 11:11:57 +0100139 args: metalava_framework_docs_args,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900140 write_sdk_values: true,
141}
142
143droidstubs {
144 name: "framework-doc-system-stubs",
145 defaults: ["framework-doc-stubs-default"],
146 arg_files: [
147 "core/res/AndroidManifest.xml",
148 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000149 args: metalava_framework_docs_args +
Anton Hansson121ccbc2020-12-17 14:56:06 +0000150 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900151 write_sdk_values: true,
satayevbc7c83e2021-06-29 22:27:06 +0100152 api_levels_sdk_type: "system",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900153}
154
155/////////////////////////////////////////////////////////////////////
156// API docs are created from the generated stub source files
157// using droiddoc
158/////////////////////////////////////////////////////////////////////
159
160framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
161 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
162 "-overview $(location core/java/overview.html) " +
163 // Federate Support Library references against local API file.
164 "-federate SupportLib https://developer.android.com " +
165 "-federationapi SupportLib $(location :current-support-api) " +
166 // Federate Support Library references against local API file.
167 "-federate AndroidX https://developer.android.com " +
168 "-federationapi AndroidX $(location :current-androidx-api) "
169
170doc_defaults {
171 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000172 libs: framework_docs_only_libs + [
173 "stub-annotations",
174 "unsupportedappusage",
175 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900176 html_dirs: [
177 "docs/html",
178 ],
179 knowntags: [
180 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100181 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900182 ],
183 custom_template: "droiddoc-templates-sdk",
184 resourcesdir: "docs/html/reference/images/",
185 resourcesoutdir: "reference/android/images/",
186 hdf: [
187 "dac true",
188 "sdk.codename O",
189 "sdk.preview.version 1",
190 "sdk.version 7.0",
191 "sdk.rel.id 1",
192 "sdk.preview 0",
193 ],
194 arg_files: [
195 "core/res/AndroidManifest.xml",
196 "core/java/overview.html",
197 ":current-support-api",
198 ":current-androidx-api",
199 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700200 // TODO(b/169090544): remove below aidl includes.
201 aidl: {
202 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -0700203 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700204 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900205}
206
207doc_defaults {
208 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900209}
210
211droiddoc {
212 name: "doc-comment-check-docs",
213 defaults: ["framework-docs-default"],
214 srcs: [
215 ":framework-doc-stubs",
216 ],
217 args: framework_docs_only_args + " -referenceonly -parsecomments",
218 installable: false,
219}
220
221droiddoc {
222 name: "offline-sdk-docs",
223 defaults: ["framework-docs-default"],
224 srcs: [
225 ":framework-doc-stubs",
226 ],
227 hdf: [
228 "android.whichdoc offline",
229 ],
atrostb1ee27b2020-02-03 11:03:16 +0000230 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900231 proofread_file: "offline-sdk-docs-proofrerad.txt",
232 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
233 static_doc_index_redirect: "docs/docs-preview-index.html",
234}
235
236droiddoc {
237 // Please sync with android-api-council@ before making any changes for the name property below.
238 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
239 // See b/116221385 for reference.
240 name: "offline-sdk-referenceonly-docs",
241 defaults: ["framework-docs-default"],
242 srcs: [
243 ":framework-doc-stubs",
244 ],
245 hdf: [
246 "android.whichdoc offline",
247 ],
248 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
249 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
250 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
251 static_doc_properties: "docs/source.properties",
252}
253
254droiddoc {
255 // Please sync with android-api-council@ before making any changes for the name property below.
256 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
257 // See b/116221385 for reference.
258 name: "offline-system-sdk-referenceonly-docs",
259 defaults: ["framework-docs-default"],
260 srcs: [
261 ":framework-doc-system-stubs",
262 ],
263 hdf: [
264 "android.whichdoc offline",
265 ],
266 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
267 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
268 " -offlinemode -title \"Android System SDK\" -referenceonly",
269 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
270 static_doc_properties: "docs/source.properties",
271}
272
273droiddoc {
274 name: "online-sdk-docs",
275 defaults: ["framework-docs-default"],
276 srcs: [
277 ":framework-doc-stubs",
278 ],
279 hdf: [
280 "android.whichdoc online",
281 "android.hasSamples true",
282 ],
283 proofread_file: "online-sdk-docs-proofrerad.txt",
284 args: framework_docs_only_args +
285 " -toroot / -samplegroup Admin " +
286 " -samplegroup Background " +
287 " -samplegroup Connectivity " +
288 " -samplegroup Content " +
289 " -samplegroup Input " +
290 " -samplegroup Media " +
291 " -samplegroup Notification " +
292 " -samplegroup RenderScript " +
293 " -samplegroup Security " +
294 " -samplegroup Sensors " +
295 " -samplegroup System " +
296 " -samplegroup Testing " +
297 " -samplegroup UI " +
298 " -samplegroup Views " +
299 " -samplegroup Wearable -samplesdir development/samples/browseable ",
300}
301
302droiddoc {
303 name: "online-system-api-sdk-docs",
304 defaults: ["framework-docs-default"],
305 srcs: [
306 ":framework-doc-system-stubs",
307 ],
308 hdf: [
309 "android.whichdoc online",
310 "android.hasSamples true",
311 ],
312 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
313 args: framework_docs_only_args +
314 " -referenceonly " +
315 " -title \"Android SDK - Including system APIs.\" " +
316 " -hide 101 " +
317 " -hide 104 " +
318 " -hide 108 " +
319 " -toroot / -samplegroup Admin " +
320 " -samplegroup Background " +
321 " -samplegroup Connectivity " +
322 " -samplegroup Content " +
323 " -samplegroup Input " +
324 " -samplegroup Media " +
325 " -samplegroup Notification " +
326 " -samplegroup RenderScript " +
327 " -samplegroup Security " +
328 " -samplegroup Sensors " +
329 " -samplegroup System " +
330 " -samplegroup Testing " +
331 " -samplegroup UI " +
332 " -samplegroup Views " +
333 " -samplegroup Wearable -samplesdir development/samples/browseable ",
334 installable: false,
335}
336
337droiddoc {
338 name: "ds-docs-java",
339 defaults: ["framework-docs-default"],
340 srcs: [
341 ":framework-doc-stubs",
342 ],
343 hdf: [
344 "android.whichdoc online",
345 "android.hasSamples true",
346 ],
347 proofread_file: "ds-docs-proofrerad.txt",
348 args: framework_docs_only_args +
349 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
350 " -samplegroup Background " +
351 " -samplegroup Connectivity " +
352 " -samplegroup Content " +
353 " -samplegroup Input " +
354 " -samplegroup Media " +
355 " -samplegroup Notification " +
356 " -samplegroup RenderScript " +
357 " -samplegroup Security " +
358 " -samplegroup Sensors " +
359 " -samplegroup System " +
360 " -samplegroup Testing " +
361 " -samplegroup UI " +
362 " -samplegroup Views " +
363 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
364}
365
366droiddoc {
367 name: "ds-docs-kt",
368 defaults: ["framework-dokka-docs-default"],
369 srcs: [
370 ":framework-doc-stubs",
371 ],
372 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700373 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900374 proofread_file: "ds-dokka-proofread.txt",
375 dokka_enabled: true,
376}
377
378java_genrule {
379 name: "ds-docs",
380 tools: [
381 "zip2zip",
382 "merge_zips",
383 ],
384 srcs: [
385 ":ds-docs-java{.docs.zip}",
386 ":ds-docs-kt{.docs.zip}",
387 ],
388 out: ["ds-docs.zip"],
389 dist: {
390 targets: ["docs"],
391 },
392 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 -0700393 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900394}
395
396java_genrule {
397 name: "ds-docs-switched",
398 tools: [
399 "switcher4",
400 "soong_zip",
401 ],
402 srcs: [
403 ":ds-docs-java{.docs.zip}",
404 ":ds-docs-kt{.docs.zip}",
405 ],
406 out: ["ds-docs-switched.zip"],
407 dist: {
408 targets: ["docs"],
409 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800410 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700411 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
412 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
413 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
414 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900415}
416
417droiddoc {
418 name: "ds-static-docs",
419 defaults: ["framework-docs-default"],
420 srcs: [
421 ":framework-doc-stubs",
422 ],
423 hdf: [
424 "android.whichdoc online",
425 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900426 args: framework_docs_only_args +
427 " -staticonly " +
428 " -toroot / " +
429 " -devsite " +
430 " -ignoreJdLinks ",
431}
432
433droiddoc {
434 name: "ds-ref-navtree-docs",
435 defaults: ["framework-docs-default"],
436 srcs: [
437 ":framework-doc-stubs",
438 ],
439 hdf: [
440 "android.whichdoc online",
441 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900442 args: framework_docs_only_args +
443 " -toroot / " +
444 " -atLinksNavtree " +
445 " -navtreeonly ",
446}
447
448droiddoc {
449 name: "online-sdk-dev-docs",
450 defaults: ["framework-docs-default"],
451 srcs: [
452 ":framework-doc-stubs",
453 ],
454 hdf: [
455 "android.whichdoc online",
456 "android.hasSamples true",
457 ],
458 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
459 args: framework_docs_only_args +
460 " -toroot / -samplegroup Admin " +
461 " -samplegroup Background " +
462 " -samplegroup Connectivity " +
463 " -samplegroup Content " +
464 " -samplegroup Input " +
465 " -samplegroup Media " +
466 " -samplegroup Notification " +
467 " -samplegroup RenderScript " +
468 " -samplegroup Security " +
469 " -samplegroup Sensors " +
470 " -samplegroup System " +
471 " -samplegroup Testing " +
472 " -samplegroup UI " +
473 " -samplegroup Views " +
474 " -samplegroup Wearable -samplesdir development/samples/browseable ",
475}
476
477droiddoc {
478 name: "hidden-docs",
479 defaults: ["framework-docs-default"],
480 srcs: [
481 ":framework-doc-stubs",
482 ],
483 proofread_file: "hidden-docs-proofrerad.txt",
484 args: framework_docs_only_args +
485 " -referenceonly " +
486 " -title \"Android SDK - Including hidden APIs.\"",
487}