blob: 03fb44fd81459e1c56a0b32f133a248154131c58 [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 ],
Anton Hansson25c8ca62023-10-27 14:57:30 +000033 flags: [
34 // These errors are suppressed in the doc stubs as it isn't easy to suppress them.
35 // They remain unsuppressed/active in the "main" stubs build (the jar stubs).
36 // These can be removed when either a) all the issues have been fixed or
37 // b) these reporting of these issues is gated behind api lint being enabled in metalava.
38 "--hide BroadcastBehavior",
39 "--hide DeprecationMismatch",
40 "--hide MissingPermission",
41 "--hide RequiresPermission",
42 "--hide SdkConstant",
43 "--hide Todo",
44 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090045 create_doc_stubs: true,
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010046 write_sdk_values: true,
Jiyong Park7fb4b182019-12-20 14:35:43 +090047}
48
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010049// Defaults module for doc-stubs targets that use module source code as input.
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010050stubs_defaults {
51 name: "framework-doc-stubs-sources-default",
Anton Hansson5aa59332022-01-21 16:32:31 +000052 defaults: ["android-non-updatable-doc-stubs-defaults"],
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010053 srcs: [
Anton Hanssonecf9fc32022-01-14 12:10:01 +000054 ":art.module.public.api{.public.stubs.source}",
55 ":conscrypt.module.public.api{.public.stubs.source}",
56 ":i18n.module.public.api{.public.stubs.source}",
57
Neha Pattanfa46dd22022-02-18 19:46:09 +000058 ":framework-adservices-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010059 ":framework-appsearch-sources",
60 ":framework-connectivity-sources",
Roopa Sattiraju8e305772022-01-20 10:05:19 -080061 ":framework-bluetooth-sources",
paulhuf45fe962021-12-14 23:09:55 +080062 ":framework-connectivity-tiramisu-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010063 ":framework-graphics-srcs",
Justin Lanninb9301172024-11-14 04:37:37 +000064 ":framework-healthfitness-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010065 ":framework-mediaprovider-sources",
Chun Zhanga615ce52021-10-29 14:57:55 -070066 ":framework-nearby-sources",
Roshan Pius05836fa2023-12-07 10:54:05 -080067 ":framework-nfc-updatable-sources",
Frank Wange97ff9e2022-02-13 07:06:31 +000068 ":framework-ondevicepersonalization-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010069 ":framework-permission-sources",
70 ":framework-permission-s-sources",
Yisroel Fortab0540e82024-01-30 16:22:06 +000071 ":framework-profiling-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010072 ":framework-scheduling-sources",
73 ":framework-sdkextensions-sources",
74 ":framework-statsd-sources",
Nikita Ioffe59029ad2022-02-24 01:56:44 +000075 ":framework-sdksandbox-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010076 ":framework-tethering-srcs",
Roshan Piusde6f1ca2021-10-14 07:34:07 -070077 ":framework-uwb-updatable-sources",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +010078 ":framework-wifi-updatable-sources",
79 ":ike-srcs",
80 ":updatable-media-srcs",
81 ],
82}
83
Jiyong Park7fb4b182019-12-20 14:35:43 +090084droidstubs {
Anton Hansson867f94c2021-05-05 10:32:31 +010085 name: "android-non-updatable-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +000086 defaults: [
87 "android-non-updatable-doc-stubs-defaults",
88 "module-classpath-stubs-defaults",
89 ],
Anton Hansson867f94c2021-05-05 10:32:31 +010090}
91
92droidstubs {
93 name: "android-non-updatable-doc-stubs-system",
Anton Hansson5aa59332022-01-21 16:32:31 +000094 defaults: [
95 "android-non-updatable-doc-stubs-defaults",
96 "module-classpath-stubs-defaults",
97 ],
Anton Hansson84a0e712023-10-23 09:17:45 +000098 flags: ["--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)"],
Anton Hansson867f94c2021-05-05 10:32:31 +010099}
100
101droidstubs {
Cole Faustdcda3702022-10-04 14:46:35 -0700102 name: "android-non-updatable-doc-stubs-module-lib",
103 defaults: [
104 "android-non-updatable-doc-stubs-defaults",
105 "module-classpath-stubs-defaults",
Anton Hansson5aa59332022-01-21 16:32:31 +0000106 ],
Anton Hansson84a0e712023-10-23 09:17:45 +0000107 flags: [
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 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700111 generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
112 write_sdk_values: false,
113}
114
115droidstubs {
116 name: "android-non-updatable-doc-stubs-system-server",
117 defaults: [
118 "android-non-updatable-doc-stubs-defaults",
119 "module-classpath-stubs-defaults",
120 ],
Anton Hansson84a0e712023-10-23 09:17:45 +0000121 flags: [
122 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
123 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
124 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\)",
125 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700126 generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
127 write_sdk_values: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900128}
129
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100130droidstubs {
Anton Hansson111e1582021-10-26 14:12:10 +0000131 name: "framework-doc-stubs",
Anton Hansson5aa59332022-01-21 16:32:31 +0000132 defaults: ["android-non-updatable-doc-stubs-defaults"],
Paul Duffind772be22024-12-09 16:54:48 +0000133 flags: [
134 // Ignore any compatibility errors, see check_api.last_released below for more information.
135 "--hide-category Compatibility",
136 ],
Jihoon Kange4553d02024-11-07 19:40:30 +0000137 srcs: [":all-modules-public-stubs-source-exportable"],
Anton Hansson247c5f22022-05-09 09:53:12 +0000138 api_levels_module: "api_versions_public",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100139 aidl: {
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100140 include_dirs: [
141 "packages/modules/Connectivity/framework/aidl-export",
Baligh Uddinb8b46fd2022-02-11 14:20:10 +0000142 "packages/modules/Media/apex/aidl/stable",
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100143 ],
144 },
Paul Duffind772be22024-12-09 16:54:48 +0000145
146 // Pass the previously released API to support reverting flagged APIs. Without this, reverting
147 // a flagged API will cause it to be removed, even if it had previously been released. This
148 // has the side effect of causing compatibility issues to be reported but they are already
149 // checked elsewhere so they will be ignored, see `--hide-category Compatibility` above.
150 check_api: {
151 last_released: {
152 api_file: ":android.api.combined.public.latest",
153 removed_api_file: ":android-removed.api.combined.public.latest",
154 },
155 },
Anton Hanssonfa5d0bc2021-09-17 16:09:08 +0100156}
157
Cole Faustdcda3702022-10-04 14:46:35 -0700158droidstubs {
159 name: "framework-doc-system-stubs",
160 defaults: ["framework-doc-stubs-sources-default"],
Paul Duffind772be22024-12-09 16:54:48 +0000161 flags: [
162 "--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\)",
163 // Ignore any compatibility errors, see check_api.last_released below for more information.
164 "--hide-category Compatibility",
165 ],
Paul Duffindd97b782023-10-16 18:37:12 +0100166 api_levels_module: "api_versions_system",
Paul Duffind772be22024-12-09 16:54:48 +0000167
168 // Pass the previously released API to support reverting flagged APIs. Without this, reverting
169 // a flagged API will cause it to be removed, even if it had previously been released. This
170 // has the side effect of causing compatibility issues to be reported but they are already
171 // checked elsewhere so they will be ignored, see `--hide-category Compatibility` above.
172 check_api: {
173 last_released: {
174 api_file: ":android.api.combined.system.latest",
175 removed_api_file: ":android-removed.api.combined.system.latest",
176 },
177 },
Cole Faustdcda3702022-10-04 14:46:35 -0700178}
179
Jiyong Park7fb4b182019-12-20 14:35:43 +0900180/////////////////////////////////////////////////////////////////////
181// API docs are created from the generated stub source files
182// using droiddoc
183/////////////////////////////////////////////////////////////////////
184
Jiyong Park7fb4b182019-12-20 14:35:43 +0900185doc_defaults {
186 name: "framework-docs-default",
Anton Hansson65370ed2023-10-11 13:46:34 +0000187 sdk_version: "none",
188 system_modules: "none",
Anton Hanssonba8f3c22023-10-10 18:52:20 +0000189 libs: [
Artur Satayevffd7f952020-01-13 16:16:27 +0000190 "stub-annotations",
191 "unsupportedappusage",
192 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900193 html_dirs: [
194 "docs/html",
195 ],
196 knowntags: [
197 "docs/knowntags.txt",
Paul Duffin8c083f62020-09-08 20:22:49 +0100198 ":art.module.public.api{.doctags}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900199 ],
200 custom_template: "droiddoc-templates-sdk",
201 resourcesdir: "docs/html/reference/images/",
202 resourcesoutdir: "reference/android/images/",
Anton Hansson0a715502023-10-03 12:13:25 +0000203 lint_baseline: "javadoc-lint-baseline",
Anton Hansson84a0e712023-10-23 09:17:45 +0000204 flags: [
205 "-android",
206 "-manifest $(location :frameworks-base-core-AndroidManifest.xml)",
207 "-metalavaApiSince",
208 "-werror",
209 "-lerror",
210 "-overview $(location :frameworks-base-java-overview)",
211 // Federate Support Library references against local API file.
212 "-federate SupportLib https://developer.android.com",
213 "-federationapi SupportLib $(location :current-support-api)",
214 // Federate Support Library references against local API file.
215 "-federate AndroidX https://developer.android.com",
216 "-federationapi AndroidX $(location :current-androidx-api)",
217 // doclava contains checks for a few issues that are have been migrated to metalava.
218 // disable them in doclava, to avoid mistriggering or double triggering.
Mårten Kongstade2da2d62024-01-11 09:53:59 +0100219 "-hide 101", // TODO: turn Lint 101 back into an error again
Anton Hansson84a0e712023-10-23 09:17:45 +0000220 "-hide 111", // HIDDEN_SUPERCLASS
221 "-hide 113", // DEPRECATION_MISMATCH
222 "-hide 125", // REQUIRES_PERMISSION
223 "-hide 126", // BROADCAST_BEHAVIOR
224 "-hide 127", // SDK_CONSTANT
225 "-hide 128", // TODO
226 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900227 hdf: [
228 "dac true",
229 "sdk.codename O",
230 "sdk.preview.version 1",
231 "sdk.version 7.0",
232 "sdk.rel.id 1",
233 "sdk.preview 0",
234 ],
235 arg_files: [
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000236 ":frameworks-base-core-AndroidManifest.xml",
237 ":frameworks-base-java-overview",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238 ":current-support-api",
239 ":current-androidx-api",
240 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700241 // TODO(b/169090544): remove below aidl includes.
242 aidl: {
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600243 include_dirs: [
244 "frameworks/av/aidl",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000245 "frameworks/base/media/aidl",
Jeff Sharkey75d4f932021-07-26 15:41:01 -0600246 "frameworks/native/libs/permission/aidl",
247 ],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -0700248 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900249}
250
Jiyong Park7fb4b182019-12-20 14:35:43 +0900251droiddoc {
252 name: "offline-sdk-docs",
253 defaults: ["framework-docs-default"],
254 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000255 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900256 ],
257 hdf: [
258 "android.whichdoc offline",
259 ],
atrostb1ee27b2020-02-03 11:03:16 +0000260 compat_config: ":global-compat-config",
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000261 proofread_file: "offline-sdk-docs-proofread.txt",
Anton Hansson84a0e712023-10-23 09:17:45 +0000262 flags: [
263 "-offlinemode",
264 "-title \"Android SDK\"",
265 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900266 static_doc_index_redirect: "docs/docs-preview-index.html",
267}
268
269droiddoc {
270 // Please sync with android-api-council@ before making any changes for the name property below.
271 // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically.
272 // See b/116221385 for reference.
273 name: "offline-sdk-referenceonly-docs",
274 defaults: ["framework-docs-default"],
275 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000276 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900277 ],
278 hdf: [
279 "android.whichdoc offline",
280 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000281 proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
Anton Hansson84a0e712023-10-23 09:17:45 +0000282 flags: [
283 "-offlinemode",
284 "-title \"Android SDK\"",
285 "-referenceonly",
286 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900287 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
288 static_doc_properties: "docs/source.properties",
289}
290
291droiddoc {
292 // Please sync with android-api-council@ before making any changes for the name property below.
293 // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically.
294 // See b/116221385 for reference.
295 name: "offline-system-sdk-referenceonly-docs",
296 defaults: ["framework-docs-default"],
297 srcs: [
298 ":framework-doc-system-stubs",
299 ],
300 hdf: [
301 "android.whichdoc offline",
302 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000303 proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
Anton Hansson84a0e712023-10-23 09:17:45 +0000304 flags: [
305 "-hide 101",
306 "-hide 104",
307 "-hide 108",
308 "-offlinemode",
309 "-title \"Android System SDK\"",
310 "-referenceonly",
311 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900312 static_doc_index_redirect: "docs/docs-documentation-redirect.html",
313 static_doc_properties: "docs/source.properties",
314}
315
316droiddoc {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900317 name: "ds-docs-java",
318 defaults: ["framework-docs-default"],
319 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000320 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900321 ],
322 hdf: [
323 "android.whichdoc online",
324 "android.hasSamples true",
325 ],
Mårten Kongstad2598fe02022-03-30 12:31:33 +0000326 proofread_file: "ds-docs-proofread.txt",
Anton Hansson84a0e712023-10-23 09:17:45 +0000327 flags: [
328 " -toroot /",
329 "-yamlV2",
330 "-samplegroup Admin",
331 "-samplegroup Background",
332 "-samplegroup Connectivity",
333 "-samplegroup Content",
334 "-samplegroup Input",
335 "-samplegroup Media",
336 "-samplegroup Notification",
337 "-samplegroup RenderScript",
338 "-samplegroup Security",
339 "-samplegroup Sensors",
340 "-samplegroup System",
341 "-samplegroup Testing",
342 "-samplegroup UI",
343 "-samplegroup Views",
344 "-samplegroup Wearable",
345 "-devsite",
346 "-samplesdir",
347 "development/samples/browseable",
348 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900349}
350
351droiddoc {
352 name: "ds-docs-kt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900353 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000354 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900355 ],
Anton Hansson84a0e712023-10-23 09:17:45 +0000356 flags: [
357 "-noJdkLink",
358 "-links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list",
Dan Willemsencece97c2020-04-20 22:32:45 -0700359 "-noStdlibLink",
Anton Hansson84a0e712023-10-23 09:17:45 +0000360 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900361 proofread_file: "ds-dokka-proofread.txt",
362 dokka_enabled: true,
363}
364
365java_genrule {
366 name: "ds-docs",
367 tools: [
368 "zip2zip",
369 "merge_zips",
370 ],
371 srcs: [
372 ":ds-docs-java{.docs.zip}",
373 ":ds-docs-kt{.docs.zip}",
374 ],
375 out: ["ds-docs.zip"],
376 dist: {
377 targets: ["docs"],
378 },
379 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 -0700380 "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900381}
382
Sorin Basca2fd4b162023-03-14 20:51:48 +0000383java_genrule {
384 name: "ds-docs-switched",
385 tools: [
386 "switcher4",
387 "soong_zip",
388 ],
389 srcs: [
390 ":ds-docs-java{.docs.zip}",
391 ":ds-docs-kt{.docs.zip}",
392 ],
393 out: ["ds-docs-switched.zip"],
394 dist: {
395 targets: ["docs"],
396 },
397 cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " +
398 "unzip -q $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " +
399 "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " +
400 "(cd $(genDir)/en/reference && $$SWITCHER --work platform) > /dev/null && " +
401 "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)",
402}
Jiyong Park7fb4b182019-12-20 14:35:43 +0900403
404droiddoc {
405 name: "ds-static-docs",
406 defaults: ["framework-docs-default"],
407 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000408 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900409 ],
410 hdf: [
411 "android.whichdoc online",
412 ],
Anton Hansson84a0e712023-10-23 09:17:45 +0000413 flags: [
414 "-staticonly",
415 "-toroot /",
416 "-devsite",
417 "-ignoreJdLinks",
418 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900419}
420
421droiddoc {
422 name: "ds-ref-navtree-docs",
423 defaults: ["framework-docs-default"],
424 srcs: [
Jihoon Kang2a829bb2024-02-01 22:01:15 +0000425 ":framework-doc-stubs{.exportable}",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900426 ],
427 hdf: [
428 "android.whichdoc online",
429 ],
Anton Hansson84a0e712023-10-23 09:17:45 +0000430 flags: [
431 "-toroot /",
432 "-atLinksNavtree",
433 "-navtreeonly",
434 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900435}