blob: 55d69f5a2ee8c5de7b011f94eeb12d30fa64cd2e [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 Hanssonc7f5e7d2021-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 Hanssonc7f5e7d2021-05-05 10:32:31 +010075 ":android-non-updatable-stub-sources",
Anton Hansson703cde02021-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 Hansson703cde02021-03-30 10:46:48 +010080 ":framework-connectivity-sources",
81 ":framework-mediaprovider-sources",
82 ":framework-permission-sources",
83 ":framework-sdkextensions-sources",
84 ":framework-statsd-sources",
85 ":framework-tethering-srcs",
86 ":framework-wifi-updatable-sources",
Paul Duffin5a4e8f22020-11-25 15:45:43 +000087 ":i18n.module.public.api{.public.stubs.source}",
Anton Hansson703cde02021-03-30 10:46:48 +010088 ":ike-srcs",
89 ":updatable-media-srcs",
90
91 // No longer part of the stubs, but are included in the docs.
92 "test-base/src/**/*.java",
Jiyong Park7fb4b182019-12-20 14:35:43 +090093 "test-mock/src/**/*.java",
94 "test-runner/src/**/*.java",
95 ],
96 libs: framework_docs_only_libs,
97 create_doc_stubs: true,
98 annotations_enabled: true,
99 api_levels_annotations_enabled: true,
100 api_levels_annotations_dirs: [
101 "sdk-dir",
102 "api-versions-jars-dir",
103 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100104 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900105 merge_annotations_dirs: [
106 "metalava-manual",
107 ],
108}
109
110droidstubs {
Anton Hanssonc7f5e7d2021-05-05 10:32:31 +0100111 name: "android-non-updatable-doc-stubs",
112 defaults: ["android-non-updatable-doc-stubs-defaults"],
113 args: metalava_framework_docs_args,
114}
115
116droidstubs {
117 name: "android-non-updatable-doc-stubs-system",
118 defaults: ["android-non-updatable-doc-stubs-defaults"],
119 args: metalava_framework_docs_args +
120 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
121}
122
123droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900124 name: "framework-doc-stubs",
125 defaults: ["framework-doc-stubs-default"],
126 arg_files: [
127 "core/res/AndroidManifest.xml",
128 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000129 args: metalava_framework_docs_args +
130 // Needed for hidden libcore annotations for now.
131 " --ignore-classes-on-classpath ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900132 write_sdk_values: true,
133}
134
135droidstubs {
136 name: "framework-doc-system-stubs",
137 defaults: ["framework-doc-stubs-default"],
138 arg_files: [
139 "core/res/AndroidManifest.xml",
140 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000141 args: metalava_framework_docs_args +
142 // Needed for hidden libcore annotations for now.
143 " --ignore-classes-on-classpath " +
144 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900145 write_sdk_values: true,
146}
147
148/////////////////////////////////////////////////////////////////////
149// API docs are created from the generated stub source files
150// using droiddoc
151/////////////////////////////////////////////////////////////////////
152
153framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
154 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
155 "-overview $(location core/java/overview.html) " +
156 // Federate Support Library references against local API file.
157 "-federate SupportLib https://developer.android.com " +
158 "-federationapi SupportLib $(location :current-support-api) " +
159 // Federate Support Library references against local API file.
160 "-federate AndroidX https://developer.android.com " +
161 "-federationapi AndroidX $(location :current-androidx-api) "
162
163doc_defaults {
164 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000165 libs: framework_docs_only_libs + [
166 "stub-annotations",
167 "unsupportedappusage",
168 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900169 html_dirs: [
170 "docs/html",
171 ],
172 knowntags: [
173 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100174 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900175 ],
176 custom_template: "droiddoc-templates-sdk",
177 resourcesdir: "docs/html/reference/images/",
178 resourcesoutdir: "reference/android/images/",
179 hdf: [
180 "dac true",
181 "sdk.codename O",
182 "sdk.preview.version 1",
183 "sdk.version 7.0",
184 "sdk.rel.id 1",
185 "sdk.preview 0",
186 ],
187 arg_files: [
188 "core/res/AndroidManifest.xml",
189 "core/java/overview.html",
190 ":current-support-api",
191 ":current-androidx-api",
192 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900193}
194
195doc_defaults {
196 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900197}
198
199droiddoc {
200 name: "doc-comment-check-docs",
201 defaults: ["framework-docs-default"],
202 srcs: [
203 ":framework-doc-stubs",
204 ],
205 args: framework_docs_only_args + " -referenceonly -parsecomments",
206 installable: false,
207}
208
209droiddoc {
210 name: "offline-sdk-docs",
211 defaults: ["framework-docs-default"],
212 srcs: [
213 ":framework-doc-stubs",
214 ],
215 hdf: [
216 "android.whichdoc offline",
217 ],
atrostb1ee27b2020-02-03 11:03:16 +0000218 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900219 proofread_file: "offline-sdk-docs-proofrerad.txt",
220 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
221 static_doc_index_redirect: "docs/docs-preview-index.html",
222}
223
224droiddoc {
225 // Please sync with android-api-council@ before making any changes for the name property below.
226 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
227 // See b/116221385 for reference.
228 name: "offline-sdk-referenceonly-docs",
229 defaults: ["framework-docs-default"],
230 srcs: [
231 ":framework-doc-stubs",
232 ],
233 hdf: [
234 "android.whichdoc offline",
235 ],
236 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
237 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
238 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
239 static_doc_properties: "docs/source.properties",
240}
241
242droiddoc {
243 // Please sync with android-api-council@ before making any changes for the name property below.
244 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
245 // See b/116221385 for reference.
246 name: "offline-system-sdk-referenceonly-docs",
247 defaults: ["framework-docs-default"],
248 srcs: [
249 ":framework-doc-system-stubs",
250 ],
251 hdf: [
252 "android.whichdoc offline",
253 ],
254 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
255 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
256 " -offlinemode -title \"Android System SDK\" -referenceonly",
257 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
258 static_doc_properties: "docs/source.properties",
259}
260
261droiddoc {
262 name: "online-sdk-docs",
263 defaults: ["framework-docs-default"],
264 srcs: [
265 ":framework-doc-stubs",
266 ],
267 hdf: [
268 "android.whichdoc online",
269 "android.hasSamples true",
270 ],
271 proofread_file: "online-sdk-docs-proofrerad.txt",
272 args: framework_docs_only_args +
273 " -toroot / -samplegroup Admin " +
274 " -samplegroup Background " +
275 " -samplegroup Connectivity " +
276 " -samplegroup Content " +
277 " -samplegroup Input " +
278 " -samplegroup Media " +
279 " -samplegroup Notification " +
280 " -samplegroup RenderScript " +
281 " -samplegroup Security " +
282 " -samplegroup Sensors " +
283 " -samplegroup System " +
284 " -samplegroup Testing " +
285 " -samplegroup UI " +
286 " -samplegroup Views " +
287 " -samplegroup Wearable -samplesdir development/samples/browseable ",
288}
289
290droiddoc {
291 name: "online-system-api-sdk-docs",
292 defaults: ["framework-docs-default"],
293 srcs: [
294 ":framework-doc-system-stubs",
295 ],
296 hdf: [
297 "android.whichdoc online",
298 "android.hasSamples true",
299 ],
300 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
301 args: framework_docs_only_args +
302 " -referenceonly " +
303 " -title \"Android SDK - Including system APIs.\" " +
304 " -hide 101 " +
305 " -hide 104 " +
306 " -hide 108 " +
307 " -toroot / -samplegroup Admin " +
308 " -samplegroup Background " +
309 " -samplegroup Connectivity " +
310 " -samplegroup Content " +
311 " -samplegroup Input " +
312 " -samplegroup Media " +
313 " -samplegroup Notification " +
314 " -samplegroup RenderScript " +
315 " -samplegroup Security " +
316 " -samplegroup Sensors " +
317 " -samplegroup System " +
318 " -samplegroup Testing " +
319 " -samplegroup UI " +
320 " -samplegroup Views " +
321 " -samplegroup Wearable -samplesdir development/samples/browseable ",
322 installable: false,
323}
324
325droiddoc {
326 name: "ds-docs-java",
327 defaults: ["framework-docs-default"],
328 srcs: [
329 ":framework-doc-stubs",
330 ],
331 hdf: [
332 "android.whichdoc online",
333 "android.hasSamples true",
334 ],
335 proofread_file: "ds-docs-proofrerad.txt",
336 args: framework_docs_only_args +
337 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
338 " -samplegroup Background " +
339 " -samplegroup Connectivity " +
340 " -samplegroup Content " +
341 " -samplegroup Input " +
342 " -samplegroup Media " +
343 " -samplegroup Notification " +
344 " -samplegroup RenderScript " +
345 " -samplegroup Security " +
346 " -samplegroup Sensors " +
347 " -samplegroup System " +
348 " -samplegroup Testing " +
349 " -samplegroup UI " +
350 " -samplegroup Views " +
351 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
352}
353
354droiddoc {
355 name: "ds-docs-kt",
356 defaults: ["framework-dokka-docs-default"],
357 srcs: [
358 ":framework-doc-stubs",
359 ],
360 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700361 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900362 proofread_file: "ds-dokka-proofread.txt",
363 dokka_enabled: true,
364}
365
366java_genrule {
367 name: "ds-docs",
368 tools: [
369 "zip2zip",
370 "merge_zips",
371 ],
372 srcs: [
373 ":ds-docs-java{.docs.zip}",
374 ":ds-docs-kt{.docs.zip}",
375 ],
376 out: ["ds-docs.zip"],
377 dist: {
378 targets: ["docs"],
379 },
380 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 -0700381 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900382}
383
384java_genrule {
385 name: "ds-docs-switched",
386 tools: [
387 "switcher4",
388 "soong_zip",
389 ],
390 srcs: [
391 ":ds-docs-java{.docs.zip}",
392 ":ds-docs-kt{.docs.zip}",
393 ],
394 out: ["ds-docs-switched.zip"],
395 dist: {
396 targets: ["docs"],
397 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800398 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700399 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
400 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
401 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
402 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900403}
404
405droiddoc {
406 name: "ds-static-docs",
407 defaults: ["framework-docs-default"],
408 srcs: [
409 ":framework-doc-stubs",
410 ],
411 hdf: [
412 "android.whichdoc online",
413 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900414 args: framework_docs_only_args +
415 " -staticonly " +
416 " -toroot / " +
417 " -devsite " +
418 " -ignoreJdLinks ",
419}
420
421droiddoc {
422 name: "ds-ref-navtree-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 " -toroot / " +
432 " -atLinksNavtree " +
433 " -navtreeonly ",
434}
435
436droiddoc {
437 name: "online-sdk-dev-docs",
438 defaults: ["framework-docs-default"],
439 srcs: [
440 ":framework-doc-stubs",
441 ],
442 hdf: [
443 "android.whichdoc online",
444 "android.hasSamples true",
445 ],
446 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
447 args: framework_docs_only_args +
448 " -toroot / -samplegroup Admin " +
449 " -samplegroup Background " +
450 " -samplegroup Connectivity " +
451 " -samplegroup Content " +
452 " -samplegroup Input " +
453 " -samplegroup Media " +
454 " -samplegroup Notification " +
455 " -samplegroup RenderScript " +
456 " -samplegroup Security " +
457 " -samplegroup Sensors " +
458 " -samplegroup System " +
459 " -samplegroup Testing " +
460 " -samplegroup UI " +
461 " -samplegroup Views " +
462 " -samplegroup Wearable -samplesdir development/samples/browseable ",
463}
464
465droiddoc {
466 name: "hidden-docs",
467 defaults: ["framework-docs-default"],
468 srcs: [
469 ":framework-doc-stubs",
470 ],
471 proofread_file: "hidden-docs-proofrerad.txt",
472 args: framework_docs_only_args +
473 " -referenceonly " +
474 " -title \"Android SDK - Including hidden APIs.\"",
475}