blob: 5f4f3c2f175b5f0cf14db4524e368b529106bebf [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",
73 ],
74 libs: framework_docs_only_libs,
75 create_doc_stubs: true,
76 annotations_enabled: true,
77 api_levels_annotations_enabled: true,
78 api_levels_annotations_dirs: [
79 "sdk-dir",
80 "api-versions-jars-dir",
81 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +010082 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090083 merge_annotations_dirs: [
84 "metalava-manual",
85 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070086 // TODO(b/169090544): remove below aidl includes.
87 aidl: {
88 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -070089 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070090 },
Jiyong Park7fb4b182019-12-20 14:35:43 +090091}
92
93droidstubs {
94 name: "framework-doc-stubs",
95 defaults: ["framework-doc-stubs-default"],
96 arg_files: [
97 "core/res/AndroidManifest.xml",
98 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +000099 args: metalava_framework_docs_args +
100 // Needed for hidden libcore annotations for now.
101 " --ignore-classes-on-classpath ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900102 write_sdk_values: true,
103}
104
105droidstubs {
106 name: "framework-doc-system-stubs",
107 defaults: ["framework-doc-stubs-default"],
108 arg_files: [
109 "core/res/AndroidManifest.xml",
110 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +0000111 args: metalava_framework_docs_args +
112 // Needed for hidden libcore annotations for now.
113 " --ignore-classes-on-classpath " +
114 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900115 write_sdk_values: true,
116}
117
118/////////////////////////////////////////////////////////////////////
119// API docs are created from the generated stub source files
120// using droiddoc
121/////////////////////////////////////////////////////////////////////
122
123framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " +
124 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
125 "-overview $(location core/java/overview.html) " +
126 // Federate Support Library references against local API file.
127 "-federate SupportLib https://developer.android.com " +
128 "-federationapi SupportLib $(location :current-support-api) " +
129 // Federate Support Library references against local API file.
130 "-federate AndroidX https://developer.android.com " +
131 "-federationapi AndroidX $(location :current-androidx-api) "
132
133doc_defaults {
134 name: "framework-docs-default",
Artur Satayevffd7f952020-01-13 16:16:27 +0000135 libs: framework_docs_only_libs + [
136 "stub-annotations",
137 "unsupportedappusage",
138 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900139 html_dirs: [
140 "docs/html",
141 ],
142 knowntags: [
143 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100144 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900145 ],
146 custom_template: "droiddoc-templates-sdk",
147 resourcesdir: "docs/html/reference/images/",
148 resourcesoutdir: "reference/android/images/",
149 hdf: [
150 "dac true",
151 "sdk.codename O",
152 "sdk.preview.version 1",
153 "sdk.version 7.0",
154 "sdk.rel.id 1",
155 "sdk.preview 0",
156 ],
157 arg_files: [
158 "core/res/AndroidManifest.xml",
159 "core/java/overview.html",
160 ":current-support-api",
161 ":current-androidx-api",
162 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700163 // TODO(b/169090544): remove below aidl includes.
164 aidl: {
165 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -0700166 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700167 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900168}
169
170doc_defaults {
171 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900172}
173
174droiddoc {
175 name: "doc-comment-check-docs",
176 defaults: ["framework-docs-default"],
177 srcs: [
178 ":framework-doc-stubs",
179 ],
180 args: framework_docs_only_args + " -referenceonly -parsecomments",
181 installable: false,
182}
183
184droiddoc {
185 name: "offline-sdk-docs",
186 defaults: ["framework-docs-default"],
187 srcs: [
188 ":framework-doc-stubs",
189 ],
190 hdf: [
191 "android.whichdoc offline",
192 ],
atrostb1ee27b2020-02-03 11:03:16 +0000193 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900194 proofread_file: "offline-sdk-docs-proofrerad.txt",
195 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
196 static_doc_index_redirect: "docs/docs-preview-index.html",
197}
198
199droiddoc {
200 // Please sync with android-api-council@ before making any changes for the name property below.
201 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
202 // See b/116221385 for reference.
203 name: "offline-sdk-referenceonly-docs",
204 defaults: ["framework-docs-default"],
205 srcs: [
206 ":framework-doc-stubs",
207 ],
208 hdf: [
209 "android.whichdoc offline",
210 ],
211 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
212 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
213 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
214 static_doc_properties: "docs/source.properties",
215}
216
217droiddoc {
218 // Please sync with android-api-council@ before making any changes for the name property below.
219 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
220 // See b/116221385 for reference.
221 name: "offline-system-sdk-referenceonly-docs",
222 defaults: ["framework-docs-default"],
223 srcs: [
224 ":framework-doc-system-stubs",
225 ],
226 hdf: [
227 "android.whichdoc offline",
228 ],
229 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
230 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
231 " -offlinemode -title \"Android System SDK\" -referenceonly",
232 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
233 static_doc_properties: "docs/source.properties",
234}
235
236droiddoc {
237 name: "online-sdk-docs",
238 defaults: ["framework-docs-default"],
239 srcs: [
240 ":framework-doc-stubs",
241 ],
242 hdf: [
243 "android.whichdoc online",
244 "android.hasSamples true",
245 ],
246 proofread_file: "online-sdk-docs-proofrerad.txt",
247 args: framework_docs_only_args +
248 " -toroot / -samplegroup Admin " +
249 " -samplegroup Background " +
250 " -samplegroup Connectivity " +
251 " -samplegroup Content " +
252 " -samplegroup Input " +
253 " -samplegroup Media " +
254 " -samplegroup Notification " +
255 " -samplegroup RenderScript " +
256 " -samplegroup Security " +
257 " -samplegroup Sensors " +
258 " -samplegroup System " +
259 " -samplegroup Testing " +
260 " -samplegroup UI " +
261 " -samplegroup Views " +
262 " -samplegroup Wearable -samplesdir development/samples/browseable ",
263}
264
265droiddoc {
266 name: "online-system-api-sdk-docs",
267 defaults: ["framework-docs-default"],
268 srcs: [
269 ":framework-doc-system-stubs",
270 ],
271 hdf: [
272 "android.whichdoc online",
273 "android.hasSamples true",
274 ],
275 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
276 args: framework_docs_only_args +
277 " -referenceonly " +
278 " -title \"Android SDK - Including system APIs.\" " +
279 " -hide 101 " +
280 " -hide 104 " +
281 " -hide 108 " +
282 " -toroot / -samplegroup Admin " +
283 " -samplegroup Background " +
284 " -samplegroup Connectivity " +
285 " -samplegroup Content " +
286 " -samplegroup Input " +
287 " -samplegroup Media " +
288 " -samplegroup Notification " +
289 " -samplegroup RenderScript " +
290 " -samplegroup Security " +
291 " -samplegroup Sensors " +
292 " -samplegroup System " +
293 " -samplegroup Testing " +
294 " -samplegroup UI " +
295 " -samplegroup Views " +
296 " -samplegroup Wearable -samplesdir development/samples/browseable ",
297 installable: false,
298}
299
300droiddoc {
301 name: "ds-docs-java",
302 defaults: ["framework-docs-default"],
303 srcs: [
304 ":framework-doc-stubs",
305 ],
306 hdf: [
307 "android.whichdoc online",
308 "android.hasSamples true",
309 ],
310 proofread_file: "ds-docs-proofrerad.txt",
311 args: framework_docs_only_args +
312 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
313 " -samplegroup Background " +
314 " -samplegroup Connectivity " +
315 " -samplegroup Content " +
316 " -samplegroup Input " +
317 " -samplegroup Media " +
318 " -samplegroup Notification " +
319 " -samplegroup RenderScript " +
320 " -samplegroup Security " +
321 " -samplegroup Sensors " +
322 " -samplegroup System " +
323 " -samplegroup Testing " +
324 " -samplegroup UI " +
325 " -samplegroup Views " +
326 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
327}
328
329droiddoc {
330 name: "ds-docs-kt",
331 defaults: ["framework-dokka-docs-default"],
332 srcs: [
333 ":framework-doc-stubs",
334 ],
335 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700336 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900337 proofread_file: "ds-dokka-proofread.txt",
338 dokka_enabled: true,
339}
340
341java_genrule {
342 name: "ds-docs",
343 tools: [
344 "zip2zip",
345 "merge_zips",
346 ],
347 srcs: [
348 ":ds-docs-java{.docs.zip}",
349 ":ds-docs-kt{.docs.zip}",
350 ],
351 out: ["ds-docs.zip"],
352 dist: {
353 targets: ["docs"],
354 },
355 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 -0700356 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900357}
358
359java_genrule {
360 name: "ds-docs-switched",
361 tools: [
362 "switcher4",
363 "soong_zip",
364 ],
365 srcs: [
366 ":ds-docs-java{.docs.zip}",
367 ":ds-docs-kt{.docs.zip}",
368 ],
369 out: ["ds-docs-switched.zip"],
370 dist: {
371 targets: ["docs"],
372 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800373 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700374 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
375 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
376 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
377 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900378}
379
380droiddoc {
381 name: "ds-static-docs",
382 defaults: ["framework-docs-default"],
383 srcs: [
384 ":framework-doc-stubs",
385 ],
386 hdf: [
387 "android.whichdoc online",
388 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900389 args: framework_docs_only_args +
390 " -staticonly " +
391 " -toroot / " +
392 " -devsite " +
393 " -ignoreJdLinks ",
394}
395
396droiddoc {
397 name: "ds-ref-navtree-docs",
398 defaults: ["framework-docs-default"],
399 srcs: [
400 ":framework-doc-stubs",
401 ],
402 hdf: [
403 "android.whichdoc online",
404 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900405 args: framework_docs_only_args +
406 " -toroot / " +
407 " -atLinksNavtree " +
408 " -navtreeonly ",
409}
410
411droiddoc {
412 name: "online-sdk-dev-docs",
413 defaults: ["framework-docs-default"],
414 srcs: [
415 ":framework-doc-stubs",
416 ],
417 hdf: [
418 "android.whichdoc online",
419 "android.hasSamples true",
420 ],
421 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
422 args: framework_docs_only_args +
423 " -toroot / -samplegroup Admin " +
424 " -samplegroup Background " +
425 " -samplegroup Connectivity " +
426 " -samplegroup Content " +
427 " -samplegroup Input " +
428 " -samplegroup Media " +
429 " -samplegroup Notification " +
430 " -samplegroup RenderScript " +
431 " -samplegroup Security " +
432 " -samplegroup Sensors " +
433 " -samplegroup System " +
434 " -samplegroup Testing " +
435 " -samplegroup UI " +
436 " -samplegroup Views " +
437 " -samplegroup Wearable -samplesdir development/samples/browseable ",
438}
439
440droiddoc {
441 name: "hidden-docs",
442 defaults: ["framework-docs-default"],
443 srcs: [
444 ":framework-doc-stubs",
445 ],
446 proofread_file: "hidden-docs-proofrerad.txt",
447 args: framework_docs_only_args +
448 " -referenceonly " +
449 " -title \"Android SDK - Including hidden APIs.\"",
450}