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: [ |
| 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", |
| 68 | ":core-current-stubs-source", |
| 69 | ":core_public_api_files", |
| 70 | "test-mock/src/**/*.java", |
| 71 | "test-runner/src/**/*.java", |
| 72 | ], |
| 73 | libs: framework_docs_only_libs, |
| 74 | create_doc_stubs: true, |
| 75 | annotations_enabled: true, |
| 76 | api_levels_annotations_enabled: true, |
| 77 | api_levels_annotations_dirs: [ |
| 78 | "sdk-dir", |
| 79 | "api-versions-jars-dir", |
| 80 | ], |
| 81 | previous_api: ":last-released-public-api", |
| 82 | merge_annotations_dirs: [ |
| 83 | "metalava-manual", |
| 84 | ], |
| 85 | } |
| 86 | |
| 87 | droidstubs { |
| 88 | name: "framework-doc-stubs", |
| 89 | defaults: ["framework-doc-stubs-default"], |
| 90 | arg_files: [ |
| 91 | "core/res/AndroidManifest.xml", |
| 92 | ], |
| 93 | args: metalava_framework_docs_args, |
| 94 | write_sdk_values: true, |
| 95 | } |
| 96 | |
| 97 | droidstubs { |
| 98 | name: "framework-doc-system-stubs", |
| 99 | defaults: ["framework-doc-stubs-default"], |
| 100 | arg_files: [ |
| 101 | "core/res/AndroidManifest.xml", |
| 102 | ], |
| 103 | args: metalava_framework_docs_args + " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) ", |
| 104 | write_sdk_values: true, |
| 105 | } |
| 106 | |
| 107 | ///////////////////////////////////////////////////////////////////// |
| 108 | // API docs are created from the generated stub source files |
| 109 | // using droiddoc |
| 110 | ///////////////////////////////////////////////////////////////////// |
| 111 | |
| 112 | framework_docs_only_args = " -android -manifest $(location core/res/AndroidManifest.xml) " + |
| 113 | "-werror -lerror -hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 " + |
| 114 | "-overview $(location core/java/overview.html) " + |
| 115 | // Federate Support Library references against local API file. |
| 116 | "-federate SupportLib https://developer.android.com " + |
| 117 | "-federationapi SupportLib $(location :current-support-api) " + |
| 118 | // Federate Support Library references against local API file. |
| 119 | "-federate AndroidX https://developer.android.com " + |
| 120 | "-federationapi AndroidX $(location :current-androidx-api) " |
| 121 | |
| 122 | doc_defaults { |
| 123 | name: "framework-docs-default", |
Artur Satayev | ffd7f95 | 2020-01-13 16:16:27 +0000 | [diff] [blame] | 124 | libs: framework_docs_only_libs + [ |
| 125 | "stub-annotations", |
| 126 | "unsupportedappusage", |
| 127 | ], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 128 | html_dirs: [ |
| 129 | "docs/html", |
| 130 | ], |
| 131 | knowntags: [ |
| 132 | "docs/knowntags.txt", |
| 133 | ":known-oj-tags", |
| 134 | ], |
| 135 | custom_template: "droiddoc-templates-sdk", |
| 136 | resourcesdir: "docs/html/reference/images/", |
| 137 | resourcesoutdir: "reference/android/images/", |
| 138 | hdf: [ |
| 139 | "dac true", |
| 140 | "sdk.codename O", |
| 141 | "sdk.preview.version 1", |
| 142 | "sdk.version 7.0", |
| 143 | "sdk.rel.id 1", |
| 144 | "sdk.preview 0", |
| 145 | ], |
| 146 | arg_files: [ |
| 147 | "core/res/AndroidManifest.xml", |
| 148 | "core/java/overview.html", |
| 149 | ":current-support-api", |
| 150 | ":current-androidx-api", |
| 151 | ], |
| 152 | create_stubs: false, |
| 153 | } |
| 154 | |
| 155 | doc_defaults { |
| 156 | name: "framework-dokka-docs-default", |
| 157 | create_stubs: false, |
| 158 | } |
| 159 | |
| 160 | droiddoc { |
| 161 | name: "doc-comment-check-docs", |
| 162 | defaults: ["framework-docs-default"], |
| 163 | srcs: [ |
| 164 | ":framework-doc-stubs", |
| 165 | ], |
| 166 | args: framework_docs_only_args + " -referenceonly -parsecomments", |
| 167 | installable: false, |
| 168 | } |
| 169 | |
| 170 | droiddoc { |
| 171 | name: "offline-sdk-docs", |
| 172 | defaults: ["framework-docs-default"], |
| 173 | srcs: [ |
| 174 | ":framework-doc-stubs", |
| 175 | ], |
| 176 | hdf: [ |
| 177 | "android.whichdoc offline", |
| 178 | ], |
| 179 | proofread_file: "offline-sdk-docs-proofrerad.txt", |
| 180 | args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"", |
| 181 | static_doc_index_redirect: "docs/docs-preview-index.html", |
| 182 | } |
| 183 | |
| 184 | droiddoc { |
| 185 | // Please sync with android-api-council@ before making any changes for the name property below. |
| 186 | // Since there's cron jobs that fetch offline-sdk-referenceonly-docs-docs.zip periodically. |
| 187 | // See b/116221385 for reference. |
| 188 | name: "offline-sdk-referenceonly-docs", |
| 189 | defaults: ["framework-docs-default"], |
| 190 | srcs: [ |
| 191 | ":framework-doc-stubs", |
| 192 | ], |
| 193 | hdf: [ |
| 194 | "android.whichdoc offline", |
| 195 | ], |
| 196 | proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt", |
| 197 | args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly", |
| 198 | static_doc_index_redirect: "docs/docs-documentation-redirect.html", |
| 199 | static_doc_properties: "docs/source.properties", |
| 200 | } |
| 201 | |
| 202 | droiddoc { |
| 203 | // Please sync with android-api-council@ before making any changes for the name property below. |
| 204 | // Since there's cron jobs that fetch offline-system-sdk-referenceonly-docs-docs.zip periodically. |
| 205 | // See b/116221385 for reference. |
| 206 | name: "offline-system-sdk-referenceonly-docs", |
| 207 | defaults: ["framework-docs-default"], |
| 208 | srcs: [ |
| 209 | ":framework-doc-system-stubs", |
| 210 | ], |
| 211 | hdf: [ |
| 212 | "android.whichdoc offline", |
| 213 | ], |
| 214 | proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt", |
| 215 | args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" + |
| 216 | " -offlinemode -title \"Android System SDK\" -referenceonly", |
| 217 | static_doc_index_redirect: "docs/docs-documentation-redirect.html", |
| 218 | static_doc_properties: "docs/source.properties", |
| 219 | } |
| 220 | |
| 221 | droiddoc { |
| 222 | name: "online-sdk-docs", |
| 223 | defaults: ["framework-docs-default"], |
| 224 | srcs: [ |
| 225 | ":framework-doc-stubs", |
| 226 | ], |
| 227 | hdf: [ |
| 228 | "android.whichdoc online", |
| 229 | "android.hasSamples true", |
| 230 | ], |
| 231 | proofread_file: "online-sdk-docs-proofrerad.txt", |
| 232 | args: framework_docs_only_args + |
| 233 | " -toroot / -samplegroup Admin " + |
| 234 | " -samplegroup Background " + |
| 235 | " -samplegroup Connectivity " + |
| 236 | " -samplegroup Content " + |
| 237 | " -samplegroup Input " + |
| 238 | " -samplegroup Media " + |
| 239 | " -samplegroup Notification " + |
| 240 | " -samplegroup RenderScript " + |
| 241 | " -samplegroup Security " + |
| 242 | " -samplegroup Sensors " + |
| 243 | " -samplegroup System " + |
| 244 | " -samplegroup Testing " + |
| 245 | " -samplegroup UI " + |
| 246 | " -samplegroup Views " + |
| 247 | " -samplegroup Wearable -samplesdir development/samples/browseable ", |
| 248 | } |
| 249 | |
| 250 | droiddoc { |
| 251 | name: "online-system-api-sdk-docs", |
| 252 | defaults: ["framework-docs-default"], |
| 253 | srcs: [ |
| 254 | ":framework-doc-system-stubs", |
| 255 | ], |
| 256 | hdf: [ |
| 257 | "android.whichdoc online", |
| 258 | "android.hasSamples true", |
| 259 | ], |
| 260 | proofread_file: "online-system-api-sdk-docs-proofrerad.txt", |
| 261 | args: framework_docs_only_args + |
| 262 | " -referenceonly " + |
| 263 | " -title \"Android SDK - Including system APIs.\" " + |
| 264 | " -hide 101 " + |
| 265 | " -hide 104 " + |
| 266 | " -hide 108 " + |
| 267 | " -toroot / -samplegroup Admin " + |
| 268 | " -samplegroup Background " + |
| 269 | " -samplegroup Connectivity " + |
| 270 | " -samplegroup Content " + |
| 271 | " -samplegroup Input " + |
| 272 | " -samplegroup Media " + |
| 273 | " -samplegroup Notification " + |
| 274 | " -samplegroup RenderScript " + |
| 275 | " -samplegroup Security " + |
| 276 | " -samplegroup Sensors " + |
| 277 | " -samplegroup System " + |
| 278 | " -samplegroup Testing " + |
| 279 | " -samplegroup UI " + |
| 280 | " -samplegroup Views " + |
| 281 | " -samplegroup Wearable -samplesdir development/samples/browseable ", |
| 282 | installable: false, |
| 283 | } |
| 284 | |
| 285 | droiddoc { |
| 286 | name: "ds-docs-java", |
| 287 | defaults: ["framework-docs-default"], |
| 288 | srcs: [ |
| 289 | ":framework-doc-stubs", |
| 290 | ], |
| 291 | hdf: [ |
| 292 | "android.whichdoc online", |
| 293 | "android.hasSamples true", |
| 294 | ], |
| 295 | proofread_file: "ds-docs-proofrerad.txt", |
| 296 | args: framework_docs_only_args + |
| 297 | " -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " + |
| 298 | " -samplegroup Background " + |
| 299 | " -samplegroup Connectivity " + |
| 300 | " -samplegroup Content " + |
| 301 | " -samplegroup Input " + |
| 302 | " -samplegroup Media " + |
| 303 | " -samplegroup Notification " + |
| 304 | " -samplegroup RenderScript " + |
| 305 | " -samplegroup Security " + |
| 306 | " -samplegroup Sensors " + |
| 307 | " -samplegroup System " + |
| 308 | " -samplegroup Testing " + |
| 309 | " -samplegroup UI " + |
| 310 | " -samplegroup Views " + |
| 311 | " -samplegroup Wearable -devsite -samplesdir development/samples/browseable ", |
| 312 | } |
| 313 | |
| 314 | droiddoc { |
| 315 | name: "ds-docs-kt", |
| 316 | defaults: ["framework-dokka-docs-default"], |
| 317 | srcs: [ |
| 318 | ":framework-doc-stubs", |
| 319 | ], |
| 320 | args: "-noJdkLink -links https://kotlinlang.org/api/latest/jvm/stdlib/^external/dokka/package-list " + |
| 321 | "-noStdlibLink", |
| 322 | proofread_file: "ds-dokka-proofread.txt", |
| 323 | dokka_enabled: true, |
| 324 | } |
| 325 | |
| 326 | java_genrule { |
| 327 | name: "ds-docs", |
| 328 | tools: [ |
| 329 | "zip2zip", |
| 330 | "merge_zips", |
| 331 | ], |
| 332 | srcs: [ |
| 333 | ":ds-docs-java{.docs.zip}", |
| 334 | ":ds-docs-kt{.docs.zip}", |
| 335 | ], |
| 336 | out: ["ds-docs.zip"], |
| 337 | dist: { |
| 338 | targets: ["docs"], |
| 339 | }, |
| 340 | cmd: "$(location zip2zip) -i $(location :ds-docs-kt{.docs.zip}) -o $(genDir)/ds-docs-kt-moved.zip **/*:en/reference/kotlin && " + |
| 341 | "$(location merge_zips) $(out) $(location :ds-docs-java{.docs.zip}) $(genDir)/ds-docs-kt-moved.zip", |
| 342 | } |
| 343 | |
| 344 | java_genrule { |
| 345 | name: "ds-docs-switched", |
| 346 | tools: [ |
| 347 | "switcher4", |
| 348 | "soong_zip", |
| 349 | ], |
| 350 | srcs: [ |
| 351 | ":ds-docs-java{.docs.zip}", |
| 352 | ":ds-docs-kt{.docs.zip}", |
| 353 | ], |
| 354 | out: ["ds-docs-switched.zip"], |
| 355 | dist: { |
| 356 | targets: ["docs"], |
| 357 | }, |
| 358 | cmd: "unzip $(location :ds-docs-java{.docs.zip}) -d $(genDir) && " + |
| 359 | "unzip $(location :ds-docs-kt{.docs.zip}) -d $(genDir)/en/reference/kotlin && " + |
| 360 | "SWITCHER=$$(cd $$(dirname $(location switcher4)) && pwd)/$$(basename $(location switcher4)) && " + |
| 361 | "(cd $(genDir)/en/reference && $$SWITCHER --work platform) && " + |
| 362 | "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)", |
| 363 | } |
| 364 | |
| 365 | droiddoc { |
| 366 | name: "ds-static-docs", |
| 367 | defaults: ["framework-docs-default"], |
| 368 | srcs: [ |
| 369 | ":framework-doc-stubs", |
| 370 | ], |
| 371 | hdf: [ |
| 372 | "android.whichdoc online", |
| 373 | ], |
| 374 | proofread_file: "ds-static-docs-proofrerad.txt", |
| 375 | args: framework_docs_only_args + |
| 376 | " -staticonly " + |
| 377 | " -toroot / " + |
| 378 | " -devsite " + |
| 379 | " -ignoreJdLinks ", |
| 380 | } |
| 381 | |
| 382 | droiddoc { |
| 383 | name: "ds-ref-navtree-docs", |
| 384 | defaults: ["framework-docs-default"], |
| 385 | srcs: [ |
| 386 | ":framework-doc-stubs", |
| 387 | ], |
| 388 | hdf: [ |
| 389 | "android.whichdoc online", |
| 390 | ], |
| 391 | proofread_file: "ds-ref-navtree-docs-proofrerad.txt", |
| 392 | args: framework_docs_only_args + |
| 393 | " -toroot / " + |
| 394 | " -atLinksNavtree " + |
| 395 | " -navtreeonly ", |
| 396 | } |
| 397 | |
| 398 | droiddoc { |
| 399 | name: "online-sdk-dev-docs", |
| 400 | defaults: ["framework-docs-default"], |
| 401 | srcs: [ |
| 402 | ":framework-doc-stubs", |
| 403 | ], |
| 404 | hdf: [ |
| 405 | "android.whichdoc online", |
| 406 | "android.hasSamples true", |
| 407 | ], |
| 408 | proofread_file: "online-sdk-dev-docs-proofrerad.txt", |
| 409 | args: framework_docs_only_args + |
| 410 | " -toroot / -samplegroup Admin " + |
| 411 | " -samplegroup Background " + |
| 412 | " -samplegroup Connectivity " + |
| 413 | " -samplegroup Content " + |
| 414 | " -samplegroup Input " + |
| 415 | " -samplegroup Media " + |
| 416 | " -samplegroup Notification " + |
| 417 | " -samplegroup RenderScript " + |
| 418 | " -samplegroup Security " + |
| 419 | " -samplegroup Sensors " + |
| 420 | " -samplegroup System " + |
| 421 | " -samplegroup Testing " + |
| 422 | " -samplegroup UI " + |
| 423 | " -samplegroup Views " + |
| 424 | " -samplegroup Wearable -samplesdir development/samples/browseable ", |
| 425 | } |
| 426 | |
| 427 | droiddoc { |
| 428 | name: "hidden-docs", |
| 429 | defaults: ["framework-docs-default"], |
| 430 | srcs: [ |
| 431 | ":framework-doc-stubs", |
| 432 | ], |
| 433 | proofread_file: "hidden-docs-proofrerad.txt", |
| 434 | args: framework_docs_only_args + |
| 435 | " -referenceonly " + |
| 436 | " -title \"Android SDK - Including hidden APIs.\"", |
| 437 | } |
| 438 | |