blob: e1621008cc33800742309eca7052dcbe97793057 [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
Anton Hansson5aa59332022-01-21 16:32:31 +000023// These defaults enable doc-stub generation, api lint database generation and sdk value generation.
Jiyong Park7fb4b182019-12-20 14:35:43 +090024stubs_defaults {
Anton Hansson867f94c2021-05-05 10:32:31 +010025 name: "android-non-updatable-doc-stubs-defaults",
Anton Hansson87f04b82022-01-17 19:27:06 +000026 defaults: ["android-non-updatable-stubs-defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090027 srcs: [
Anton Hansson35c0b092021-03-30 10:46:48 +010028 // No longer part of the stubs, but are included in the docs.
Anton Hansson2e25fdc2021-05-10 12:40:05 +010029 ":android-test-base-sources",
30 ":android-test-mock-sources",
31 ":android-test-runner-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090032 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090033 create_doc_stubs: true,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010034 write_sdk_values: true,
Jiyong Park7fb4b182019-12-20 14:35:43 +090035}
36
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010037// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010038stubs_defaults {
39 name: "framework-doc-stubs-sources-default",
Anton Hansson5aa59332022-01-21 16:32:31 +000040 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010041 srcs: [
Anton Hanssonecf9fc32022-01-14 12:10:01 +000042 ":art.module.public.api{.public.stubs.source}",
43 ":conscrypt.module.public.api{.public.stubs.source}",
44 ":i18n.module.public.api{.public.stubs.source}",
45
Neha Pattanfa46dd22022-02-18 19:46:09 +000046 ":framework-adservices-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010047 ":framework-appsearch-sources",
48 ":framework-connectivity-sources",
Roopa Sattiraju8e305772022-01-20 10:05:19 -080049 ":framework-bluetooth-sources",
paulhuf45fe962021-12-14 23:09:55 +080050 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010051 ":framework-graphics-srcs",
52 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -070053 ":framework-nearby-sources",
Frank Wange97ff9e2022-02-13 07:06:31 +000054 ":framework-ondevicepersonalization-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010055 ":framework-permission-sources",
56 ":framework-permission-s-sources",
57 ":framework-scheduling-sources",
58 ":framework-sdkextensions-sources",
59 ":framework-statsd-sources",
Nikita Ioffe59029ad2022-02-24 01:56:44 +000060 ":framework-sdksandbox-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010061 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -070062 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010063 ":framework-wifi-updatable-sources",
64 ":ike-srcs",
65 ":updatable-media-srcs",
66 ],
67}
68
Jiyong Park7fb4b182019-12-20 14:35:43 +090069droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +010070 name: "android-non-updatable-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +000071 defaults: [
72 "android-non-updatable-doc-stubs-defaults",
73 "module-classpath-stubs-defaults",
74 ],
Anton Hansson867f94c2021-05-05 10:32:31 +010075 args: metalava_framework_docs_args,
76}
77
78droidstubs {
79 name: "android-non-updatable-doc-stubs-system",
Anton Hansson5aa59332022-01-21 16:32:31 +000080 defaults: [
81 "android-non-updatable-doc-stubs-defaults",
82 "module-classpath-stubs-defaults",
83 ],
Anton Hansson867f94c2021-05-05 10:32:31 +010084 args: metalava_framework_docs_args +
85 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
86}
87
88droidstubs {
Cole Faustdcda3702022-10-04 14:46:35 -070089 name: "android-non-updatable-doc-stubs-module-lib",
90 defaults: [
91 "android-non-updatable-doc-stubs-defaults",
92 "module-classpath-stubs-defaults",
Anton Hansson5aa59332022-01-21 16:32:31 +000093 ],
Cole Faustdcda3702022-10-04 14:46:35 -070094 args: metalava_framework_docs_args +
95 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " +
96 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) ",
97 generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
98 write_sdk_values: false,
99}
100
101droidstubs {
102 name: "android-non-updatable-doc-stubs-system-server",
103 defaults: [
104 "android-non-updatable-doc-stubs-defaults",
105 "module-classpath-stubs-defaults",
106 ],
107 args: metalava_framework_docs_args +
108 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " +
109 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) " +
110 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\) ",
111 generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
112 write_sdk_values: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900113}
114
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100115droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000116 name: "framework-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000117 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonecf9fc32022-01-14 12:10:01 +0000118 srcs: [":all-modules-public-stubs-source"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100119 args: metalava_framework_docs_args,
Anton Hansson247c5f22022-05-09 09:53:12 +0000120 api_levels_module: "api_versions_public",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100121 aidl: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100122 include_dirs: [
123 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddinb8b46fd2022-02-11 14:20:10 +0000124 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100125 ],
126 },
127}
128
Cole Faustdcda3702022-10-04 14:46:35 -0700129droidstubs {
130 name: "framework-doc-system-stubs",
131 defaults: ["framework-doc-stubs-sources-default"],
132 args: metalava_framework_docs_args +
133 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
Paul Duffindd97b782023-10-16 18:37:12 +0100134 api_levels_module: "api_versions_system",
Cole Faustdcda3702022-10-04 14:46:35 -0700135}
136
Jiyong Park7fb4b182019-12-20 14:35:43 +0900137/////////////////////////////////////////////////////////////////////
138// API docs are created from the generated stub source files
139// using droiddoc
140/////////////////////////////////////////////////////////////////////
141
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000142framework_docs_only_args = " -android -manifest $(location :frameworks-base-core-AndroidManifest.xml) " +
Mårten Kongstad7f769482022-11-18 08:27:45 +0100143 "-metalavaApiSince " +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900144 "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " +
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000145 "-overview $(location :frameworks-base-java-overview) " +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900146 // Federate Support Library references against local API file.
147 "-federate SupportLib https://developer.android.com " +
148 "-federationapi SupportLib $(location :current-support-api) " +
149 // Federate Support Library references against local API file.
150 "-federate AndroidX https://developer.android.com " +
151 "-federationapi AndroidX $(location :current-androidx-api) "
152
153doc_defaults {
154 name: "framework-docs-default",
Anton Hansson65370ed2023-10-11 13:46:34 +0000155 sdk_version: "none",
156 system_modules: "none",
Anton Hanssonba8f3c22023-10-10 18:52:20 +0000157 libs: [
Artur Satayevffd7f952020-01-13 16:16:27 +0000158 "stub-annotations",
159 "unsupportedappusage",
160 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900161 html_dirs: [
162 "docs/html",
163 ],
164 knowntags: [
165 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100166 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900167 ],
168 custom_template: "droiddoc-templates-sdk",
169 resourcesdir: "docs/html/reference/images/",
170 resourcesoutdir: "reference/android/images/",
Anton Hansson0a715502023-10-03 12:13:25 +0000171 lint_baseline: "javadoc-lint-baseline",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900172 hdf: [
173 "dac true",
174 "sdk.codename O",
175 "sdk.preview.version 1",
176 "sdk.version 7.0",
177 "sdk.rel.id 1",
178 "sdk.preview 0",
179 ],
180 arg_files: [
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000181 ":frameworks-base-core-AndroidManifest.xml",
182 ":frameworks-base-java-overview",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900183 ":current-support-api",
184 ":current-androidx-api",
185 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700186 // TODO(b/169090544): remove below aidl includes.
187 aidl: {
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600188 include_dirs: [
189 "frameworks/av/aidl",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000190 "frameworks/base/media/aidl",
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600191 "frameworks/native/libs/permission/aidl",
192 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700193 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900194}
195
Jiyong Park7fb4b182019-12-20 14:35:43 +0900196droiddoc {
197 name: "offline-sdk-docs",
198 defaults: ["framework-docs-default"],
199 srcs: [
200 ":framework-doc-stubs",
201 ],
202 hdf: [
203 "android.whichdoc offline",
204 ],
atrostb1ee27b2020-02-03 11:03:16 +0000205 compat_config: ":global-compat-config",
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000206 proofread_file: "offline-sdk-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900207 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
208 static_doc_index_redirect: "docs/docs-preview-index.html",
209}
210
211droiddoc {
212 // Please sync with android-api-council@ before making any changes for the name property below.
213 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
214 // See b/116221385 for reference.
215 name: "offline-sdk-referenceonly-docs",
216 defaults: ["framework-docs-default"],
217 srcs: [
218 ":framework-doc-stubs",
219 ],
220 hdf: [
221 "android.whichdoc offline",
222 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000223 proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224 args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
225 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
226 static_doc_properties: "docs/source.properties",
227}
228
229droiddoc {
230 // Please sync with android-api-council@ before making any changes for the name property below.
231 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
232 // See b/116221385 for reference.
233 name: "offline-system-sdk-referenceonly-docs",
234 defaults: ["framework-docs-default"],
235 srcs: [
236 ":framework-doc-system-stubs",
237 ],
238 hdf: [
239 "android.whichdoc offline",
240 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000241 proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900242 args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
243 " -offlinemode -title \"Android System SDK\" -referenceonly",
244 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
245 static_doc_properties: "docs/source.properties",
246}
247
248droiddoc {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900249 name: "ds-docs-java",
250 defaults: ["framework-docs-default"],
251 srcs: [
252 ":framework-doc-stubs",
253 ],
254 hdf: [
255 "android.whichdoc online",
256 "android.hasSamples true",
257 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000258 proofread_file: "ds-docs-proofread.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900259 args: framework_docs_only_args +
Mårten Kongstad7f769482022-11-18 08:27:45 +0100260 " -toroot / -yamlV2 -samplegroup Admin " +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900261 " -samplegroup Background " +
262 " -samplegroup Connectivity " +
263 " -samplegroup Content " +
264 " -samplegroup Input " +
265 " -samplegroup Media " +
266 " -samplegroup Notification " +
267 " -samplegroup RenderScript " +
268 " -samplegroup Security " +
269 " -samplegroup Sensors " +
270 " -samplegroup System " +
271 " -samplegroup Testing " +
272 " -samplegroup UI " +
273 " -samplegroup Views " +
274 " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ",
275}
276
277droiddoc {
278 name: "ds-docs-kt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900279 srcs: [
280 ":framework-doc-stubs",
281 ],
282 args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " +
Dan Willemsencece97c2020-04-20 22:32:45 -0700283 "-noStdlibLink",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900284 proofread_file: "ds-dokka-proofread.txt",
285 dokka_enabled: true,
286}
287
288java_genrule {
289 name: "ds-docs",
290 tools: [
291 "zip2zip",
292 "merge_zips",
293 ],
294 srcs: [
295 ":ds-docs-java{.docs.zip}",
296 ":ds-docs-kt{.docs.zip}",
297 ],
298 out: ["ds-docs.zip"],
299 dist: {
300 targets: ["docs"],
301 },
302 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 -0700303 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900304}
305
Sorin Basca2fd4b162023-03-14 20:51:48 +0000306java_genrule {
307 name: "ds-docs-switched",
308 tools: [
309 "switcher4",
310 "soong_zip",
311 ],
312 srcs: [
313 ":ds-docs-java{.docs.zip}",
314 ":ds-docs-kt{.docs.zip}",
315 ],
316 out: ["ds-docs-switched.zip"],
317 dist: {
318 targets: ["docs"],
319 },
320 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
321 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
322 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
323 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
324 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
325}
Jiyong Park7fb4b182019-12-20 14:35:43 +0900326
327droiddoc {
328 name: "ds-static-docs",
329 defaults: ["framework-docs-default"],
330 srcs: [
331 ":framework-doc-stubs",
332 ],
333 hdf: [
334 "android.whichdoc online",
335 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900336 args: framework_docs_only_args +
337 " -staticonly " +
338 " -toroot / " +
339 " -devsite " +
340 " -ignoreJdLinks ",
341}
342
343droiddoc {
344 name: "ds-ref-navtree-docs",
345 defaults: ["framework-docs-default"],
346 srcs: [
347 ":framework-doc-stubs",
348 ],
349 hdf: [
350 "android.whichdoc online",
351 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900352 args: framework_docs_only_args +
353 " -toroot / " +
354 " -atLinksNavtree " +
355 " -navtreeonly ",
356}