blob: a786bf4adf05bbeabfc031bee93e7a12961390f2 [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: [
Anton Hansson77ff72f2021-03-30 10:11:22 +010061 ":framework-non-updatable-stub-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090062 ":framework-updatable-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090063 "test-base/src/**/*.java",
Paul Duffin404b26a2020-09-16 14:26:47 +010064 ":art.module.public.api{.public.stubs.source}",
Paul Duffine55d4e32020-05-14 17:55:46 +010065 ":conscrypt.module.public.api{.public.stubs.source}",
Paul Duffin5a4e8f22020-11-25 15:45:43 +000066 ":i18n.module.public.api{.public.stubs.source}",
Jiyong Park7fb4b182019-12-20 14:35:43 +090067 "test-mock/src/**/*.java",
68 "test-runner/src/**/*.java",
69 ],
70 libs: framework_docs_only_libs,
71 create_doc_stubs: true,
72 annotations_enabled: true,
73 api_levels_annotations_enabled: true,
74 api_levels_annotations_dirs: [
75 "sdk-dir",
76 "api-versions-jars-dir",
77 ],
Anton Hanssonf68ddea2020-05-02 17:49:26 +010078 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090079 merge_annotations_dirs: [
80 "metalava-manual",
81 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070082 // TODO(b/169090544): remove below aidl includes.
83 aidl: {
84 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -070085 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070086 },
Jiyong Park7fb4b182019-12-20 14:35:43 +090087}
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 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700159 // TODO(b/169090544): remove below aidl includes.
160 aidl: {
161 local_include_dirs: ["media/aidl"],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -0700162 include_dirs: ["frameworks/av/aidl"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700163 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900164}
165
166doc_defaults {
167 name: "framework-dokka-docs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900168}
169
170droiddoc {
171 name: "doc-comment-check-docs",
172 defaults: ["framework-docs-default"],
173 srcs: [
174 ":framework-doc-stubs",
175 ],
176 args: framework_docs_only_args + " -referenceonly -parsecomments",
177 installable: false,
178}
179
180droiddoc {
181 name: "offline-sdk-docs",
182 defaults: ["framework-docs-default"],
183 srcs: [
184 ":framework-doc-stubs",
185 ],
186 hdf: [
187 "android.whichdoc offline",
188 ],
atrostb1ee27b2020-02-03 11:03:16 +0000189 compat_config: ":global-compat-config",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900190 proofread_file: "offline-sdk-docs-proofrerad.txt",
191 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
192 static_doc_index_redirect: "docs/docs-preview-index.html",
193}
194
195droiddoc {
196 // Please sync with android-api-council@ before making any changes for the name property below.
197 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
198 // See b/116221385 for reference.
199 name: "offline-sdk-referenceonly-docs",
200 defaults: ["framework-docs-default"],
201 srcs: [
202 ":framework-doc-stubs",
203 ],
204 hdf: [
205 "android.whichdoc offline",
206 ],
207 proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
208 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
209 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
210 static_doc_properties: "docs/source.properties",
211}
212
213droiddoc {
214 // Please sync with android-api-council@ before making any changes for the name property below.
215 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
216 // See b/116221385 for reference.
217 name: "offline-system-sdk-referenceonly-docs",
218 defaults: ["framework-docs-default"],
219 srcs: [
220 ":framework-doc-system-stubs",
221 ],
222 hdf: [
223 "android.whichdoc offline",
224 ],
225 proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
226 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
227 " -offlinemode -title \"Android System SDK\" -referenceonly",
228 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
229 static_doc_properties: "docs/source.properties",
230}
231
232droiddoc {
233 name: "online-sdk-docs",
234 defaults: ["framework-docs-default"],
235 srcs: [
236 ":framework-doc-stubs",
237 ],
238 hdf: [
239 "android.whichdoc online",
240 "android.hasSamples true",
241 ],
242 proofread_file: "online-sdk-docs-proofrerad.txt",
243 args: framework_docs_only_args +
244 " -toroot / -samplegroup Admin " +
245 " -samplegroup Background " +
246 " -samplegroup Connectivity " +
247 " -samplegroup Content " +
248 " -samplegroup Input " +
249 " -samplegroup Media " +
250 " -samplegroup Notification " +
251 " -samplegroup RenderScript " +
252 " -samplegroup Security " +
253 " -samplegroup Sensors " +
254 " -samplegroup System " +
255 " -samplegroup Testing " +
256 " -samplegroup UI " +
257 " -samplegroup Views " +
258 " -samplegroup Wearable -samplesdir development/samples/browseable ",
259}
260
261droiddoc {
262 name: "online-system-api-sdk-docs",
263 defaults: ["framework-docs-default"],
264 srcs: [
265 ":framework-doc-system-stubs",
266 ],
267 hdf: [
268 "android.whichdoc online",
269 "android.hasSamples true",
270 ],
271 proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
272 args: framework_docs_only_args +
273 " -referenceonly " +
274 " -title \"Android SDK - Including system APIs.\" " +
275 " -hide 101 " +
276 " -hide 104 " +
277 " -hide 108 " +
278 " -toroot / -samplegroup Admin " +
279 " -samplegroup Background " +
280 " -samplegroup Connectivity " +
281 " -samplegroup Content " +
282 " -samplegroup Input " +
283 " -samplegroup Media " +
284 " -samplegroup Notification " +
285 " -samplegroup RenderScript " +
286 " -samplegroup Security " +
287 " -samplegroup Sensors " +
288 " -samplegroup System " +
289 " -samplegroup Testing " +
290 " -samplegroup UI " +
291 " -samplegroup Views " +
292 " -samplegroup Wearable -samplesdir development/samples/browseable ",
293 installable: false,
294}
295
296droiddoc {
297 name: "ds-docs-java",
298 defaults: ["framework-docs-default"],
299 srcs: [
300 ":framework-doc-stubs",
301 ],
302 hdf: [
303 "android.whichdoc online",
304 "android.hasSamples true",
305 ],
306 proofread_file: "ds-docs-proofrerad.txt",
307 args: framework_docs_only_args +
308 " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
309 " -samplegroup Background " +
310 " -samplegroup Connectivity " +
311 " -samplegroup Content " +
312 " -samplegroup Input " +
313 " -samplegroup Media " +
314 " -samplegroup Notification " +
315 " -samplegroup RenderScript " +
316 " -samplegroup Security " +
317 " -samplegroup Sensors " +
318 " -samplegroup System " +
319 " -samplegroup Testing " +
320 " -samplegroup UI " +
321 " -samplegroup Views " +
322 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
323}
324
325droiddoc {
326 name: "ds-docs-kt",
327 defaults: ["framework-dokka-docs-default"],
328 srcs: [
329 ":framework-doc-stubs",
330 ],
331 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700332 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900333 proofread_file: "ds-dokka-proofread.txt",
334 dokka_enabled: true,
335}
336
337java_genrule {
338 name: "ds-docs",
339 tools: [
340 "zip2zip",
341 "merge_zips",
342 ],
343 srcs: [
344 ":ds-docs-java{.docs.zip}",
345 ":ds-docs-kt{.docs.zip}",
346 ],
347 out: ["ds-docs.zip"],
348 dist: {
349 targets: ["docs"],
350 },
351 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 -0700352 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900353}
354
355java_genrule {
356 name: "ds-docs-switched",
357 tools: [
358 "switcher4",
359 "soong_zip",
360 ],
361 srcs: [
362 ":ds-docs-java{.docs.zip}",
363 ":ds-docs-kt{.docs.zip}",
364 ],
365 out: ["ds-docs-switched.zip"],
366 dist: {
367 targets: ["docs"],
368 },
Colin Crossa2410eb2020-02-26 13:04:57 -0800369 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700370 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
371 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
372 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
373 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900374}
375
376droiddoc {
377 name: "ds-static-docs",
378 defaults: ["framework-docs-default"],
379 srcs: [
380 ":framework-doc-stubs",
381 ],
382 hdf: [
383 "android.whichdoc online",
384 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900385 args: framework_docs_only_args +
386 " -staticonly " +
387 " -toroot / " +
388 " -devsite " +
389 " -ignoreJdLinks ",
390}
391
392droiddoc {
393 name: "ds-ref-navtree-docs",
394 defaults: ["framework-docs-default"],
395 srcs: [
396 ":framework-doc-stubs",
397 ],
398 hdf: [
399 "android.whichdoc online",
400 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900401 args: framework_docs_only_args +
402 " -toroot / " +
403 " -atLinksNavtree " +
404 " -navtreeonly ",
405}
406
407droiddoc {
408 name: "online-sdk-dev-docs",
409 defaults: ["framework-docs-default"],
410 srcs: [
411 ":framework-doc-stubs",
412 ],
413 hdf: [
414 "android.whichdoc online",
415 "android.hasSamples true",
416 ],
417 proofread_file: "online-sdk-dev-docs-proofrerad.txt",
418 args: framework_docs_only_args +
419 " -toroot / -samplegroup Admin " +
420 " -samplegroup Background " +
421 " -samplegroup Connectivity " +
422 " -samplegroup Content " +
423 " -samplegroup Input " +
424 " -samplegroup Media " +
425 " -samplegroup Notification " +
426 " -samplegroup RenderScript " +
427 " -samplegroup Security " +
428 " -samplegroup Sensors " +
429 " -samplegroup System " +
430 " -samplegroup Testing " +
431 " -samplegroup UI " +
432 " -samplegroup Views " +
433 " -samplegroup Wearable -samplesdir development/samples/browseable ",
434}
435
436droiddoc {
437 name: "hidden-docs",
438 defaults: ["framework-docs-default"],
439 srcs: [
440 ":framework-doc-stubs",
441 ],
442 proofread_file: "hidden-docs-proofrerad.txt",
443 args: framework_docs_only_args +
444 " -referenceonly " +
445 " -title \"Android SDK - Including hidden APIs.\"",
446}