blob: 5c20b8c2dedb1ef4f2c54dd9cf7f5755614f9d6e [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 {
59 name: "framework-doc-stubs-default",
60 srcs: [
61 ":framework-mime-sources",
62 ":framework-non-updatable-sources",
63 ":framework-updatable-sources",
64 "core/java/**/*.logtags",
65 "test-base/src/**/*.java",
66 ":opt-telephony-srcs",
67 ":opt-net-voip-srcs",
Paul Duffin404b26a2020-09-16 14:26:47 +010068 ":art.module.public.api{.public.stubs.source}",
Paul Duffine55d4e32020-05-14 17:55:46 +010069 ":conscrypt.module.public.api{.public.stubs.source}",
Paul Duffin5a4e8f22020-11-25 15:45:43 +000070 ":i18n.module.public.api{.public.stubs.source}",
Jiyong Park7fb4b182019-12-20 14:35:43 +090071 "test-mock/src/**/*.java",
72 "test-runner/src/**/*.java",
Anton Hansson406fe4a2021-03-30 10:11:42 +010073 "**/package.html",
Jiyong Park7fb4b182019-12-20 14:35:43 +090074 ],
75 libs: framework_docs_only_libs,
76 create_doc_stubs: true,
77 annotations_enabled: true,
78 api_levels_annotations_enabled: true,
79 api_levels_annotations_dirs: [
80 "sdk-dir",
81 "api-versions-jars-dir",
82 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +010083 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090084 merge_annotations_dirs: [
85 "metalava-manual",
86 ],
87}
88
89droidstubs {
90 name: "framework-doc-stubs",
91 defaults: ["framework-doc-stubs-default"],
92 arg_files: [
93 "core/res/AndroidManifest.xml",
94 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +000095 args: metalava_framework_docs_args +
96 // Needed for hidden libcore annotations for now.
97 " --ignore-classes-on-classpath ",
Jiyong Park7fb4b182019-12-20 14:35:43 +090098 write_sdk_values: true,
99}
100
101droidstubs {
102 name: "framework-doc-system-stubs",
103 defaults: ["framework-doc-stubs-default"],
104 arg_files: [
105 "core/res/AndroidManifest.xml",
106 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000107 args: metalava_framework_docs_args +
108 // Needed for hidden libcore annotations for now.
109 " --ignore-classes-on-classpath " +
110 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900111 write_sdk_values: true,
112}
113
114/////////////////////////////////////////////////////////////////////
115// API docs are created from the generated stub source files
116// using droiddoc
117/////////////////////////////////////////////////////////////////////
118
119framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
120 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
121 "-overview $(location core/java/overview.html) " +
122 // Federate Support Library references against local API file.
123 "-federate SupportLib https://developer.android.com " +
124 "-federationapi SupportLib $(location :current-support-api) " +
125 // Federate Support Library references against local API file.
126 "-federate AndroidX https://developer.android.com " +
127 "-federationapi AndroidX $(location :current-androidx-api) "
128
129doc_defaults {
130 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000131 libs: framework_docs_only_libs + [
132 "stub-annotations",
133 "unsupportedappusage",
134 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900135 html_dirs: [
136 "docs/html",
137 ],
138 knowntags: [
139 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100140 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900141 ],
142 custom_template: "droiddoc-templates-sdk",
143 resourcesdir: "docs/html/reference/images/",
144 resourcesoutdir: "reference/android/images/",
145 hdf: [
146 "dac true",
147 "sdk.codename O",
148 "sdk.preview.version 1",
149 "sdk.version 7.0",
150 "sdk.rel.id 1",
151 "sdk.preview 0",
152 ],
153 arg_files: [
154 "core/res/AndroidManifest.xml",
155 "core/java/overview.html",
156 ":current-support-api",
157 ":current-androidx-api",
158 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900159}
160
161doc_defaults {
162 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900163}
164
165droiddoc {
166 name: "doc-comment-check-docs",
167 defaults: ["framework-docs-default"],
168 srcs: [
169 ":framework-doc-stubs",
170 ],
171 args: framework_docs_only_args + " -referenceonly -parsecomments",
172 installable: false,
173}
174
175droiddoc {
176 name: "offline-sdk-docs",
177 defaults: ["framework-docs-default"],
178 srcs: [
179 ":framework-doc-stubs",
180 ],
181 hdf: [
182 "android.whichdoc offline",
183 ],
atrostb1ee27b2020-02-03 11:03:16 +0000184 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900185 proofread_file: "offline-sdk-docs-proofrerad.txt",
186 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
187 static_doc_index_redirect: "docs/docs-preview-index.html",
188}
189
190droiddoc {
191 // Please sync with android-api-council@ before making any changes for the name property below.
192 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
193 // See b/116221385 for reference.
194 name: "offline-sdk-referenceonly-docs",
195 defaults: ["framework-docs-default"],
196 srcs: [
197 ":framework-doc-stubs",
198 ],
199 hdf: [
200 "android.whichdoc offline",
201 ],
202 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
203 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
204 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
205 static_doc_properties: "docs/source.properties",
206}
207
208droiddoc {
209 // Please sync with android-api-council@ before making any changes for the name property below.
210 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
211 // See b/116221385 for reference.
212 name: "offline-system-sdk-referenceonly-docs",
213 defaults: ["framework-docs-default"],
214 srcs: [
215 ":framework-doc-system-stubs",
216 ],
217 hdf: [
218 "android.whichdoc offline",
219 ],
220 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
221 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
222 " -offlinemode -title \"Android System SDK\" -referenceonly",
223 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
224 static_doc_properties: "docs/source.properties",
225}
226
227droiddoc {
228 name: "online-sdk-docs",
229 defaults: ["framework-docs-default"],
230 srcs: [
231 ":framework-doc-stubs",
232 ],
233 hdf: [
234 "android.whichdoc online",
235 "android.hasSamples true",
236 ],
237 proofread_file: "online-sdk-docs-proofrerad.txt",
238 args: framework_docs_only_args +
239 " -toroot / -samplegroup Admin " +
240 " -samplegroup Background " +
241 " -samplegroup Connectivity " +
242 " -samplegroup Content " +
243 " -samplegroup Input " +
244 " -samplegroup Media " +
245 " -samplegroup Notification " +
246 " -samplegroup RenderScript " +
247 " -samplegroup Security " +
248 " -samplegroup Sensors " +
249 " -samplegroup System " +
250 " -samplegroup Testing " +
251 " -samplegroup UI " +
252 " -samplegroup Views " +
253 " -samplegroup Wearable -samplesdir development/samples/browseable ",
254}
255
256droiddoc {
257 name: "online-system-api-sdk-docs",
258 defaults: ["framework-docs-default"],
259 srcs: [
260 ":framework-doc-system-stubs",
261 ],
262 hdf: [
263 "android.whichdoc online",
264 "android.hasSamples true",
265 ],
266 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
267 args: framework_docs_only_args +
268 " -referenceonly " +
269 " -title \"Android SDK - Including system APIs.\" " +
270 " -hide 101 " +
271 " -hide 104 " +
272 " -hide 108 " +
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 installable: false,
289}
290
291droiddoc {
292 name: "ds-docs-java",
293 defaults: ["framework-docs-default"],
294 srcs: [
295 ":framework-doc-stubs",
296 ],
297 hdf: [
298 "android.whichdoc online",
299 "android.hasSamples true",
300 ],
301 proofread_file: "ds-docs-proofrerad.txt",
302 args: framework_docs_only_args +
303 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
304 " -samplegroup Background " +
305 " -samplegroup Connectivity " +
306 " -samplegroup Content " +
307 " -samplegroup Input " +
308 " -samplegroup Media " +
309 " -samplegroup Notification " +
310 " -samplegroup RenderScript " +
311 " -samplegroup Security " +
312 " -samplegroup Sensors " +
313 " -samplegroup System " +
314 " -samplegroup Testing " +
315 " -samplegroup UI " +
316 " -samplegroup Views " +
317 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
318}
319
320droiddoc {
321 name: "ds-docs-kt",
322 defaults: ["framework-dokka-docs-default"],
323 srcs: [
324 ":framework-doc-stubs",
325 ],
326 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700327 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900328 proofread_file: "ds-dokka-proofread.txt",
329 dokka_enabled: true,
330}
331
332java_genrule {
333 name: "ds-docs",
334 tools: [
335 "zip2zip",
336 "merge_zips",
337 ],
338 srcs: [
339 ":ds-docs-java{.docs.zip}",
340 ":ds-docs-kt{.docs.zip}",
341 ],
342 out: ["ds-docs.zip"],
343 dist: {
344 targets: ["docs"],
345 },
346 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 -0700347 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900348}
349
350java_genrule {
351 name: "ds-docs-switched",
352 tools: [
353 "switcher4",
354 "soong_zip",
355 ],
356 srcs: [
357 ":ds-docs-java{.docs.zip}",
358 ":ds-docs-kt{.docs.zip}",
359 ],
360 out: ["ds-docs-switched.zip"],
361 dist: {
362 targets: ["docs"],
363 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800364 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700365 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
366 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
367 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
368 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900369}
370
371droiddoc {
372 name: "ds-static-docs",
373 defaults: ["framework-docs-default"],
374 srcs: [
375 ":framework-doc-stubs",
376 ],
377 hdf: [
378 "android.whichdoc online",
379 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900380 args: framework_docs_only_args +
381 " -staticonly " +
382 " -toroot / " +
383 " -devsite " +
384 " -ignoreJdLinks ",
385}
386
387droiddoc {
388 name: "ds-ref-navtree-docs",
389 defaults: ["framework-docs-default"],
390 srcs: [
391 ":framework-doc-stubs",
392 ],
393 hdf: [
394 "android.whichdoc online",
395 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900396 args: framework_docs_only_args +
397 " -toroot / " +
398 " -atLinksNavtree " +
399 " -navtreeonly ",
400}
401
402droiddoc {
403 name: "online-sdk-dev-docs",
404 defaults: ["framework-docs-default"],
405 srcs: [
406 ":framework-doc-stubs",
407 ],
408 hdf: [
409 "android.whichdoc online",
410 "android.hasSamples true",
411 ],
412 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
413 args: framework_docs_only_args +
414 " -toroot / -samplegroup Admin " +
415 " -samplegroup Background " +
416 " -samplegroup Connectivity " +
417 " -samplegroup Content " +
418 " -samplegroup Input " +
419 " -samplegroup Media " +
420 " -samplegroup Notification " +
421 " -samplegroup RenderScript " +
422 " -samplegroup Security " +
423 " -samplegroup Sensors " +
424 " -samplegroup System " +
425 " -samplegroup Testing " +
426 " -samplegroup UI " +
427 " -samplegroup Views " +
428 " -samplegroup Wearable -samplesdir development/samples/browseable ",
429}
430
431droiddoc {
432 name: "hidden-docs",
433 defaults: ["framework-docs-default"],
434 srcs: [
435 ":framework-doc-stubs",
436 ],
437 proofread_file: "hidden-docs-proofrerad.txt",
438 args: framework_docs_only_args +
439 " -referenceonly " +
440 " -title \"Android SDK - Including hidden APIs.\"",
441}