Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 1 | // 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 | |
| 27 | framework_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 | |
| 58 | stubs_defaults { |
| 59 | name: "framework-doc-stubs-default", |
| 60 | srcs: [ |
Anton Hansson | 77ff72f | 2021-03-30 10:11:22 +0100 | [diff] [blame] | 61 | ":framework-non-updatable-stub-sources", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 62 | ":framework-updatable-sources", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 63 | "test-base/src/**/*.java", |
Paul Duffin | 404b26a | 2020-09-16 14:26:47 +0100 | [diff] [blame] | 64 | ":art.module.public.api{.public.stubs.source}", |
Paul Duffin | e55d4e3 | 2020-05-14 17:55:46 +0100 | [diff] [blame] | 65 | ":conscrypt.module.public.api{.public.stubs.source}", |
Paul Duffin | 5a4e8f2 | 2020-11-25 15:45:43 +0000 | [diff] [blame] | 66 | ":i18n.module.public.api{.public.stubs.source}", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 67 | "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 Hansson | f68ddea | 2020-05-02 17:49:26 +0100 | [diff] [blame] | 78 | previous_api: ":android.api.public.latest", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 79 | merge_annotations_dirs: [ |
| 80 | "metalava-manual", |
| 81 | ], |
Ytai Ben-Tsvi | da7c21e | 2020-09-16 13:04:31 -0700 | [diff] [blame] | 82 | // TODO(b/169090544): remove below aidl includes. |
| 83 | aidl: { |
| 84 | local_include_dirs: ["media/aidl"], |
Ytai Ben-Tsvi | c3cd3cd | 2020-10-30 12:34:51 -0700 | [diff] [blame] | 85 | include_dirs: ["frameworks/av/aidl"], |
Ytai Ben-Tsvi | da7c21e | 2020-09-16 13:04:31 -0700 | [diff] [blame] | 86 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | droidstubs { |
| 90 | name: "framework-doc-stubs", |
| 91 | defaults: ["framework-doc-stubs-default"], |
| 92 | arg_files: [ |
| 93 | "core/res/AndroidManifest.xml", |
| 94 | ], |
Anton Hansson | 121ccbc | 2020-12-17 14:56:06 +0000 | [diff] [blame] | 95 | args: metalava_framework_docs_args + |
| 96 | // Needed for hidden libcore annotations for now. |
| 97 | " --ignore-classes-on-classpath ", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 98 | write_sdk_values: true, |
| 99 | } |
| 100 | |
| 101 | droidstubs { |
| 102 | name: "framework-doc-system-stubs", |
| 103 | defaults: ["framework-doc-stubs-default"], |
| 104 | arg_files: [ |
| 105 | "core/res/AndroidManifest.xml", |
| 106 | ], |
Anton Hansson | 121ccbc | 2020-12-17 14:56:06 +0000 | [diff] [blame] | 107 | 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 Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 111 | write_sdk_values: true, |
| 112 | } |
| 113 | |
| 114 | ///////////////////////////////////////////////////////////////////// |
| 115 | // API docs are created from the generated stub source files |
| 116 | // using droiddoc |
| 117 | ///////////////////////////////////////////////////////////////////// |
| 118 | |
| 119 | framework_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 | |
| 129 | doc_defaults { |
| 130 | name: "framework-docs-default", |
Artur Satayev | ffd7f95 | 2020-01-13 16:16:27 +0000 | [diff] [blame] | 131 | libs: framework_docs_only_libs + [ |
| 132 | "stub-annotations", |
| 133 | "unsupportedappusage", |
| 134 | ], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 135 | html_dirs: [ |
| 136 | "docs/html", |
| 137 | ], |
| 138 | knowntags: [ |
| 139 | "docs/knowntags.txt", |
Paul Duffin | 8c083f6 | 2020-09-08 20:22:49 +0100 | [diff] [blame] | 140 | ":art.module.public.api{.doctags}", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 141 | ], |
| 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-Tsvi | da7c21e | 2020-09-16 13:04:31 -0700 | [diff] [blame] | 159 | // TODO(b/169090544): remove below aidl includes. |
| 160 | aidl: { |
| 161 | local_include_dirs: ["media/aidl"], |
Ytai Ben-Tsvi | c3cd3cd | 2020-10-30 12:34:51 -0700 | [diff] [blame] | 162 | include_dirs: ["frameworks/av/aidl"], |
Ytai Ben-Tsvi | da7c21e | 2020-09-16 13:04:31 -0700 | [diff] [blame] | 163 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | doc_defaults { |
| 167 | name: "framework-dokka-docs-default", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | droiddoc { |
| 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 | |
| 180 | droiddoc { |
| 181 | name: "offline-sdk-docs", |
| 182 | defaults: ["framework-docs-default"], |
| 183 | srcs: [ |
| 184 | ":framework-doc-stubs", |
| 185 | ], |
| 186 | hdf: [ |
| 187 | "android.whichdoc offline", |
| 188 | ], |
atrost | b1ee27b | 2020-02-03 11:03:16 +0000 | [diff] [blame] | 189 | compat_config: ":global-compat-config", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 190 | 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 | |
| 195 | droiddoc { |
| 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 | |
| 213 | droiddoc { |
| 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 | |
| 232 | droiddoc { |
| 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 | |
| 261 | droiddoc { |
| 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 | |
| 296 | droiddoc { |
| 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 | |
| 325 | droiddoc { |
| 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 Willemsen | cece97c | 2020-04-20 22:32:45 -0700 | [diff] [blame] | 332 | "-noStdlibLink", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 333 | proofread_file: "ds-dokka-proofread.txt", |
| 334 | dokka_enabled: true, |
| 335 | } |
| 336 | |
| 337 | java_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 Willemsen | cece97c | 2020-04-20 22:32:45 -0700 | [diff] [blame] | 352 | "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | java_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 Cross | a2410eb | 2020-02-26 13:04:57 -0800 | [diff] [blame] | 369 | cmd: "unzip -q $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " + |
Dan Willemsen | cece97c | 2020-04-20 22:32:45 -0700 | [diff] [blame] | 370 | "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 Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | droiddoc { |
| 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 Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 385 | args: framework_docs_only_args + |
| 386 | " -staticonly " + |
| 387 | " -toroot / " + |
| 388 | " -devsite " + |
| 389 | " -ignoreJdLinks ", |
| 390 | } |
| 391 | |
| 392 | droiddoc { |
| 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 Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 401 | args: framework_docs_only_args + |
| 402 | " -toroot / " + |
| 403 | " -atLinksNavtree " + |
| 404 | " -navtreeonly ", |
| 405 | } |
| 406 | |
| 407 | droiddoc { |
| 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 | |
| 436 | droiddoc { |
| 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 | } |