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 stubs are generated: |
| 16 | // |
| 17 | // raw source files --(metalava)--> stub source files --(javac)--> stub jar files |
| 18 | // |
| 19 | // The metalava conversion is done by droidstub modules *-api-stubs-docs. |
| 20 | // The javac compilation is done by java_library modules android_*_stubs_current. |
| 21 | // The metalava conversion is also responsible for creating API signature files |
| 22 | // and comparing them against the last API signature in api/*-current.txt files |
| 23 | // and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt |
| 24 | // files. |
| 25 | |
| 26 | ///////////////////////////////////////////////////////////////////// |
| 27 | // Common metalava configs |
| 28 | ///////////////////////////////////////////////////////////////////// |
| 29 | |
| 30 | packages_to_document = [ |
| 31 | "android", |
| 32 | "dalvik", |
| 33 | "java", |
| 34 | "javax", |
| 35 | "junit", |
| 36 | "org.apache.http", |
| 37 | "org.json", |
| 38 | "org.w3c.dom", |
| 39 | "org.xml.sax", |
| 40 | "org.xmlpull", |
| 41 | ] |
| 42 | |
| 43 | stubs_defaults { |
| 44 | name: "metalava-api-stubs-default", |
| 45 | srcs: [ |
| 46 | ":framework-non-updatable-sources", |
| 47 | ":framework-updatable-sources", |
| 48 | "core/java/**/*.logtags", |
| 49 | ":opt-telephony-srcs", |
| 50 | ":opt-net-voip-srcs", |
| 51 | ":core-current-stubs-source", |
| 52 | ":core_public_api_files", |
| 53 | ":ike-api-srcs", |
| 54 | ], |
| 55 | libs: ["framework-internal-utils"], |
| 56 | installable: false, |
| 57 | annotations_enabled: true, |
| 58 | previous_api: ":last-released-public-api", |
| 59 | merge_annotations_dirs: [ |
| 60 | "metalava-manual", |
| 61 | ], |
| 62 | api_levels_annotations_enabled: true, |
| 63 | api_levels_annotations_dirs: [ |
| 64 | "sdk-dir", |
| 65 | "api-versions-jars-dir", |
| 66 | ], |
| 67 | sdk_version: "core_platform", |
| 68 | filter_packages: packages_to_document, |
| 69 | } |
| 70 | |
| 71 | ///////////////////////////////////////////////////////////////////// |
| 72 | // *-api-stubs-docs modules providing source files for the stub libraries |
| 73 | ///////////////////////////////////////////////////////////////////// |
| 74 | |
| 75 | droidstubs { |
| 76 | name: "api-stubs-docs", |
| 77 | defaults: ["metalava-api-stubs-default"], |
| 78 | api_filename: "public_api.txt", |
| 79 | private_api_filename: "private.txt", |
| 80 | removed_api_filename: "removed.txt", |
| 81 | arg_files: [ |
| 82 | "core/res/AndroidManifest.xml", |
| 83 | ], |
| 84 | args: metalava_framework_docs_args, |
| 85 | check_api: { |
| 86 | current: { |
| 87 | api_file: "api/current.txt", |
| 88 | removed_api_file: "api/removed.txt", |
| 89 | }, |
| 90 | last_released: { |
| 91 | api_file: ":last-released-public-api", |
| 92 | removed_api_file: "api/removed.txt", |
| 93 | baseline_file: ":public-api-incompatibilities-with-last-released", |
| 94 | }, |
| 95 | api_lint: { |
| 96 | enabled: true, |
| 97 | new_since: ":last-released-public-api", |
| 98 | baseline_file: "api/lint-baseline.txt", |
| 99 | }, |
| 100 | }, |
| 101 | jdiff_enabled: true, |
| 102 | } |
| 103 | |
| 104 | droidstubs { |
| 105 | name: "system-api-stubs-docs", |
| 106 | defaults: ["metalava-api-stubs-default"], |
| 107 | api_tag_name: "SYSTEM", |
| 108 | api_filename: "system-api.txt", |
| 109 | private_api_filename: "system-private.txt", |
| 110 | private_dex_api_filename: "system-private-dex.txt", |
| 111 | removed_api_filename: "system-removed.txt", |
| 112 | arg_files: [ |
| 113 | "core/res/AndroidManifest.xml", |
| 114 | ], |
| 115 | args: metalava_framework_docs_args + " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\)", |
| 116 | check_api: { |
| 117 | current: { |
| 118 | api_file: "api/system-current.txt", |
| 119 | removed_api_file: "api/system-removed.txt", |
| 120 | }, |
| 121 | last_released: { |
| 122 | api_file: ":last-released-system-api", |
| 123 | removed_api_file: "api/system-removed.txt", |
| 124 | baseline_file: ":system-api-incompatibilities-with-last-released" |
| 125 | }, |
| 126 | api_lint: { |
| 127 | enabled: true, |
| 128 | new_since: ":last-released-system-api", |
| 129 | baseline_file: "api/system-lint-baseline.txt", |
| 130 | }, |
| 131 | }, |
| 132 | jdiff_enabled: true, |
| 133 | } |
| 134 | |
| 135 | droidstubs { |
| 136 | name: "test-api-stubs-docs", |
| 137 | defaults: ["metalava-api-stubs-default"], |
| 138 | api_tag_name: "TEST", |
| 139 | api_filename: "test-api.txt", |
| 140 | removed_api_filename: "test-removed.txt", |
| 141 | arg_files: [ |
| 142 | "core/res/AndroidManifest.xml", |
| 143 | ], |
| 144 | args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi", |
| 145 | check_api: { |
| 146 | current: { |
| 147 | api_file: "api/test-current.txt", |
| 148 | removed_api_file: "api/test-removed.txt", |
| 149 | }, |
| 150 | api_lint: { |
| 151 | enabled: true, |
| 152 | baseline_file: "api/test-lint-baseline.txt", |
| 153 | }, |
| 154 | }, |
| 155 | } |
| 156 | |
| 157 | ///////////////////////////////////////////////////////////////////// |
| 158 | // android_*_stubs_current modules are the stubs libraries compiled |
| 159 | // from *-api-stubs-docs |
| 160 | ///////////////////////////////////////////////////////////////////// |
| 161 | |
| 162 | java_defaults { |
| 163 | name: "framework-stubs-default", |
| 164 | errorprone: { |
| 165 | javacflags: [ |
| 166 | "-XepDisableAllChecks", |
| 167 | ], |
| 168 | }, |
| 169 | java_resources: [ |
| 170 | ":notices-for-framework-stubs", |
| 171 | ], |
| 172 | sdk_version: "core_current", |
| 173 | system_modules: "none", |
| 174 | java_version: "1.8", |
| 175 | compile_dex: true, |
| 176 | } |
| 177 | |
| 178 | java_library_static { |
| 179 | name: "android_stubs_current", |
| 180 | srcs: [ |
| 181 | ":api-stubs-docs", |
| 182 | ], |
| 183 | libs: [ |
| 184 | "stub-annotations", |
| 185 | ], |
| 186 | static_libs: [ |
| 187 | "private-stub-annotations-jar", |
| 188 | ], |
| 189 | defaults: ["framework-stubs-default"], |
| 190 | } |
| 191 | |
| 192 | java_library_static { |
| 193 | name: "android_system_stubs_current", |
| 194 | srcs: [ |
| 195 | ":system-api-stubs-docs", |
| 196 | ], |
| 197 | libs: [ |
| 198 | "stub-annotations", |
| 199 | ], |
| 200 | static_libs: [ |
| 201 | "private-stub-annotations-jar", |
| 202 | ], |
| 203 | defaults: ["framework-stubs-default"], |
| 204 | } |
| 205 | |
| 206 | java_library_static { |
| 207 | name: "android_test_stubs_current", |
| 208 | srcs: [ |
| 209 | ":test-api-stubs-docs", |
| 210 | ], |
| 211 | libs: [ |
| 212 | "stub-annotations", |
| 213 | ], |
| 214 | static_libs: [ |
| 215 | "private-stub-annotations-jar", |
| 216 | ], |
| 217 | defaults: ["framework-stubs-default"], |
| 218 | } |
| 219 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 220 | ///////////////////////////////////////////////////////////////////// |
| 221 | // hwbinder.stubs provides APIs required for building HIDL Java |
| 222 | // libraries. |
| 223 | ///////////////////////////////////////////////////////////////////// |
| 224 | |
| 225 | droidstubs { |
| 226 | name: "hwbinder-stubs-docs", |
| 227 | srcs: [ |
| 228 | "core/java/android/os/HidlSupport.java", |
| 229 | "core/java/android/annotation/IntDef.java", |
| 230 | "core/java/android/annotation/IntRange.java", |
| 231 | "core/java/android/annotation/NonNull.java", |
| 232 | "core/java/android/annotation/SystemApi.java", |
| 233 | "core/java/android/os/HidlMemory.java", |
| 234 | "core/java/android/os/HwBinder.java", |
| 235 | "core/java/android/os/HwBlob.java", |
| 236 | "core/java/android/os/HwParcel.java", |
| 237 | "core/java/android/os/IHwBinder.java", |
| 238 | "core/java/android/os/IHwInterface.java", |
| 239 | "core/java/android/os/DeadObjectException.java", |
| 240 | "core/java/android/os/DeadSystemException.java", |
| 241 | "core/java/android/os/NativeHandle.java", |
| 242 | "core/java/android/os/RemoteException.java", |
| 243 | "core/java/android/util/AndroidException.java", |
| 244 | ], |
| 245 | installable: false, |
| 246 | sdk_version: "core_platform", |
| 247 | annotations_enabled: true, |
| 248 | previous_api: ":last-released-public-api", |
| 249 | merge_annotations_dirs: [ |
| 250 | "metalava-manual", |
| 251 | ], |
| 252 | args: " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\)", |
| 253 | } |
| 254 | |
| 255 | java_library_static { |
| 256 | name: "hwbinder.stubs", |
| 257 | sdk_version: "core_current", |
| 258 | srcs: [ |
| 259 | ":hwbinder-stubs-docs", |
| 260 | ], |
| 261 | } |
| 262 | |
| 263 | ///////////////////////////////////////////////////////////////////// |
| 264 | // Stubs for hiddenapi processing. |
| 265 | ///////////////////////////////////////////////////////////////////// |
| 266 | |
| 267 | droidstubs { |
| 268 | name: "hiddenapi-lists-docs", |
| 269 | defaults: ["metalava-api-stubs-default"], |
| 270 | arg_files: [ |
| 271 | "core/res/AndroidManifest.xml", |
| 272 | ], |
| 273 | dex_api_filename: "public-dex.txt", |
| 274 | private_dex_api_filename: "private-dex.txt", |
| 275 | removed_dex_api_filename: "removed-dex.txt", |
| 276 | args: metalava_framework_docs_args + |
| 277 | " --show-unannotated " + |
| 278 | " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " + |
| 279 | " --show-annotation android.annotation.TestApi ", |
| 280 | } |
| 281 | |
| 282 | droidstubs { |
| 283 | name: "hiddenapi-mappings", |
| 284 | defaults: ["metalava-api-stubs-default"], |
| 285 | srcs: [ |
| 286 | ":opt-telephony-common-srcs", |
| 287 | ], |
| 288 | |
| 289 | arg_files: [ |
| 290 | "core/res/AndroidManifest.xml", |
| 291 | ], |
| 292 | dex_mapping_filename: "dex-mapping.txt", |
| 293 | args: metalava_framework_docs_args + |
| 294 | " --hide ReferencesHidden " + |
| 295 | " --hide UnhiddenSystemApi " + |
| 296 | " --show-unannotated " + |
| 297 | " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " + |
| 298 | " --show-annotation android.annotation.TestApi ", |
| 299 | } |
| 300 | |
| 301 | ///////////////////////////////////////////////////////////////////// |
| 302 | // api/*-current.txt files for use by modules in other directories |
| 303 | // like the CTS test |
| 304 | ///////////////////////////////////////////////////////////////////// |
| 305 | |
| 306 | filegroup { |
| 307 | name: "frameworks-base-api-current.txt", |
| 308 | srcs: [ |
| 309 | "api/current.txt", |
| 310 | ], |
| 311 | } |
| 312 | |
| 313 | filegroup { |
| 314 | name: "frameworks-base-api-system-current.txt", |
| 315 | srcs: [ |
| 316 | "api/system-current.txt", |
| 317 | ], |
| 318 | } |
| 319 | |
| 320 | filegroup { |
| 321 | name: "frameworks-base-api-system-removed.txt", |
| 322 | srcs: [ |
| 323 | "api/system-removed.txt", |
| 324 | ], |
| 325 | } |