Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 1 | // Copyright (C) 2021 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 | // |
| 16 | // Definitions for building the Android core libraries, i.e. ART, I18n and |
| 17 | // Conscrypt. |
| 18 | // |
| 19 | // These are here as the definitions are used by the build itself and include |
| 20 | // parts from all three of those modules. |
| 21 | // |
| 22 | |
| 23 | // A stubs target containing the parts of the public SDK API provided by the |
| 24 | // core libraries. |
| 25 | // |
| 26 | // Don't use this directly, use "sdk_version: core_current". |
Bob Badour | 36dc7c6 | 2021-08-27 13:30:35 -0700 | [diff] [blame] | 27 | package { |
| 28 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 29 | } |
| 30 | |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 31 | dist_targets = [ |
| 32 | "sdk", |
| 33 | "win_sdk", |
| 34 | ] |
| 35 | |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 36 | java_library { |
| 37 | name: "core.current.stubs", |
| 38 | visibility: ["//visibility:public"], |
| 39 | static_libs: [ |
| 40 | "art.module.public.api.stubs", |
| 41 | "conscrypt.module.public.api.stubs", |
| 42 | "i18n.module.public.api.stubs", |
| 43 | ], |
| 44 | sdk_version: "none", |
| 45 | system_modules: "none", |
| 46 | |
| 47 | dist: { |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 48 | targets: dist_targets, |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 49 | }, |
| 50 | } |
| 51 | |
| 52 | // Distributed with the SDK for turning into system modules to compile apps |
| 53 | // against. |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 54 | // |
| 55 | // Also, produces dist files that are used by the |
| 56 | // prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk |
| 57 | // directory. |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 58 | java_library { |
| 59 | name: "core-current-stubs-for-system-modules", |
| 60 | visibility: ["//development/sdk"], |
| 61 | static_libs: [ |
| 62 | "core.current.stubs", |
| 63 | // This one is not on device but it's needed when javac compiles code |
| 64 | // containing lambdas. |
| 65 | "core-lambda-stubs-for-system-modules", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 66 | ], |
| 67 | sdk_version: "none", |
| 68 | system_modules: "none", |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 69 | dists: [ |
| 70 | { |
| 71 | // Legacy dist location for the public file. |
| 72 | dest: "core-for-system-modules.jar", |
| 73 | targets: dist_targets, |
| 74 | }, |
| 75 | { |
| 76 | dest: "system-modules/public/core-for-system-modules.jar", |
| 77 | targets: dist_targets, |
| 78 | }, |
| 79 | ], |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 80 | } |
| 81 | |
Spandan Das | b0f3d42 | 2023-03-29 20:59:47 +0000 | [diff] [blame^] | 82 | // Defaults module to strip out android annotations |
| 83 | java_defaults { |
| 84 | name: "system-modules-no-annotations", |
| 85 | sdk_version: "none", |
| 86 | system_modules: "none", |
| 87 | jarjar_rules: "jarjar-strip-annotations-rules.txt", |
| 88 | } |
| 89 | |
Sorin Basca | bdbae60 | 2022-07-26 15:24:15 +0100 | [diff] [blame] | 90 | // Same as core-current-stubs-for-system-modules, but android annotations are |
| 91 | // stripped. |
| 92 | java_library { |
| 93 | name: "core-current-stubs-for-system-modules-no-annotations", |
| 94 | visibility: ["//development/sdk"], |
Spandan Das | b0f3d42 | 2023-03-29 20:59:47 +0000 | [diff] [blame^] | 95 | defaults: [ |
| 96 | "system-modules-no-annotations", |
| 97 | ], |
Sorin Basca | bdbae60 | 2022-07-26 15:24:15 +0100 | [diff] [blame] | 98 | static_libs: [ |
| 99 | "core-current-stubs-for-system-modules", |
| 100 | ], |
Sorin Basca | bdbae60 | 2022-07-26 15:24:15 +0100 | [diff] [blame] | 101 | dists: [ |
| 102 | { |
| 103 | // Legacy dist location for the public file. |
| 104 | dest: "core-for-system-modules-no-annotations.jar", |
| 105 | targets: dist_targets, |
| 106 | }, |
| 107 | { |
| 108 | dest: "system-modules/public/core-for-system-modules-no-annotations.jar", |
| 109 | targets: dist_targets, |
| 110 | }, |
| 111 | ], |
Sorin Basca | bdbae60 | 2022-07-26 15:24:15 +0100 | [diff] [blame] | 112 | } |
| 113 | |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 114 | // Used when compiling higher-level code against core.current.stubs. |
| 115 | java_system_modules { |
Paul Duffin | 10fb76f | 2021-11-03 16:53:31 +0000 | [diff] [blame] | 116 | name: "core-public-stubs-system-modules", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 117 | visibility: ["//visibility:public"], |
| 118 | libs: [ |
Sorin Basca | bdbae60 | 2022-07-26 15:24:15 +0100 | [diff] [blame] | 119 | "core-current-stubs-for-system-modules-no-annotations", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 120 | ], |
| 121 | } |
| 122 | |
| 123 | // A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API |
| 124 | // provided by the core libraries. |
| 125 | // |
| 126 | // Don't use this directly, use "sdk_version: module_current". |
| 127 | java_library { |
| 128 | name: "core.module_lib.stubs", |
| 129 | static_libs: [ |
| 130 | "art.module.public.api.stubs.module_lib", |
| 131 | |
| 132 | // Replace the following with the module-lib correspondence when Conscrypt or i18N module |
| 133 | // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides |
| 134 | // @SystemApi(MODULE_LIBRARIES). |
| 135 | "conscrypt.module.public.api.stubs", |
| 136 | "i18n.module.public.api.stubs", |
| 137 | ], |
| 138 | sdk_version: "none", |
| 139 | system_modules: "none", |
| 140 | visibility: ["//visibility:private"], |
| 141 | } |
| 142 | |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 143 | // Produces a dist file that is used by the |
| 144 | // prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk |
| 145 | // directory. |
| 146 | java_library { |
| 147 | name: "core-module-lib-stubs-for-system-modules", |
| 148 | visibility: ["//visibility:private"], |
| 149 | static_libs: [ |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 150 | "core.module_lib.stubs", |
| 151 | // This one is not on device but it's needed when javac compiles code |
| 152 | // containing lambdas. |
| 153 | "core-lambda-stubs-for-system-modules", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 154 | ], |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 155 | sdk_version: "none", |
| 156 | system_modules: "none", |
| 157 | dist: { |
| 158 | dest: "system-modules/module-lib/core-for-system-modules.jar", |
| 159 | targets: dist_targets, |
| 160 | }, |
| 161 | } |
| 162 | |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 163 | // Same as core-module-lib-stubs-for-system-modules, but android annotations are |
| 164 | // stripped. This is used by the Java toolchain, while the annotated stub is to |
| 165 | // be used by Kotlin one. |
| 166 | java_library { |
| 167 | name: "core-module-lib-stubs-for-system-modules-no-annotations", |
| 168 | visibility: ["//visibility:private"], |
Spandan Das | b0f3d42 | 2023-03-29 20:59:47 +0000 | [diff] [blame^] | 169 | defaults: [ |
| 170 | "system-modules-no-annotations", |
| 171 | ], |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 172 | static_libs: [ |
| 173 | "core-module-lib-stubs-for-system-modules", |
| 174 | ], |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 175 | dist: { |
| 176 | dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar", |
| 177 | targets: dist_targets, |
| 178 | }, |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 179 | } |
| 180 | |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 181 | // Used when compiling higher-level code with sdk_version "module_current" |
| 182 | java_system_modules { |
| 183 | name: "core-module-lib-stubs-system-modules", |
| 184 | libs: [ |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 185 | "core-module-lib-stubs-for-system-modules-no-annotations", |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame] | 186 | ], |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 187 | visibility: ["//visibility:public"], |
| 188 | } |
| 189 | |
| 190 | // Ideally this should be a restricted allowlist but there are hundreds of modules that depend on |
| 191 | // this. |
| 192 | // TODO(http://b/134561230) - limit the number of dependents on this. |
| 193 | core_platform_visibility = ["//visibility:public"] |
| 194 | |
| 195 | // Libraries containing the core platform API stubs for the core libraries. |
| 196 | // |
| 197 | // Although this stubs library is primarily used by the Java compiler / build to indicate |
| 198 | // the core platform API surface area, compile_dex: true is used so that the Core Platform |
| 199 | // API annotations are available to the dex tools that enable enforcement of runtime |
| 200 | // accessibility. b/119068555 |
| 201 | java_library { |
| 202 | name: "legacy.core.platform.api.stubs", |
| 203 | visibility: core_platform_visibility, |
| 204 | hostdex: true, |
| 205 | compile_dex: true, |
| 206 | |
| 207 | sdk_version: "none", |
| 208 | system_modules: "none", |
| 209 | static_libs: [ |
| 210 | "art.module.public.api.stubs.module_lib", |
| 211 | "conscrypt.module.platform.api.stubs", |
| 212 | "legacy.i18n.module.platform.api.stubs", |
| 213 | ], |
| 214 | patch_module: "java.base", |
| 215 | } |
| 216 | |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 217 | // Same as legacy.core.platform.api.stubs, but android annotations are |
| 218 | // stripped. This is used by the Java toolchain, while the annotated stub is to |
| 219 | // be used by Kotlin one. |
| 220 | java_library { |
| 221 | name: "legacy.core.platform.api.no.annotations.stubs", |
| 222 | visibility: core_platform_visibility, |
Spandan Das | b0f3d42 | 2023-03-29 20:59:47 +0000 | [diff] [blame^] | 223 | defaults: [ |
| 224 | "system-modules-no-annotations", |
| 225 | ], |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 226 | hostdex: true, |
| 227 | compile_dex: true, |
| 228 | |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 229 | static_libs: [ |
| 230 | "legacy.core.platform.api.stubs", |
| 231 | ], |
| 232 | patch_module: "java.base", |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 233 | } |
| 234 | |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 235 | java_library { |
| 236 | name: "stable.core.platform.api.stubs", |
| 237 | visibility: core_platform_visibility, |
| 238 | hostdex: true, |
| 239 | compile_dex: true, |
| 240 | |
| 241 | sdk_version: "none", |
| 242 | system_modules: "none", |
| 243 | static_libs: [ |
| 244 | "art.module.public.api.stubs.module_lib", |
| 245 | // conscrypt only has a stable version, so it is okay to depend on it here: |
| 246 | "conscrypt.module.platform.api.stubs", |
| 247 | "stable.i18n.module.platform.api.stubs", |
| 248 | ], |
| 249 | patch_module: "java.base", |
| 250 | } |
| 251 | |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 252 | // Same as stable.core.platform.api.stubs, but android annotations are |
| 253 | // stripped. This is used by the Java toolchain, while the annotated stub is to |
| 254 | // be used by Kotlin one. |
| 255 | java_library { |
| 256 | name: "stable.core.platform.api.no.annotations.stubs", |
| 257 | visibility: core_platform_visibility, |
Spandan Das | b0f3d42 | 2023-03-29 20:59:47 +0000 | [diff] [blame^] | 258 | defaults: [ |
| 259 | "system-modules-no-annotations", |
| 260 | ], |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 261 | hostdex: true, |
| 262 | compile_dex: true, |
| 263 | |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 264 | static_libs: [ |
| 265 | "stable.core.platform.api.stubs", |
| 266 | ], |
| 267 | patch_module: "java.base", |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 268 | } |
| 269 | |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 270 | // Used when compiling higher-level code against *.core.platform.api.stubs. |
| 271 | java_system_modules { |
| 272 | name: "legacy-core-platform-api-stubs-system-modules", |
| 273 | visibility: core_platform_visibility, |
| 274 | libs: [ |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 275 | "legacy.core.platform.api.no.annotations.stubs", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 276 | // This one is not on device but it's needed when javac compiles code |
| 277 | // containing lambdas. |
| 278 | "core-lambda-stubs-for-system-modules", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 279 | ], |
| 280 | } |
| 281 | |
| 282 | java_system_modules { |
| 283 | name: "stable-core-platform-api-stubs-system-modules", |
| 284 | visibility: core_platform_visibility, |
| 285 | libs: [ |
Sorin Basca | 69f4b08 | 2022-05-09 13:55:11 +0100 | [diff] [blame] | 286 | "stable.core.platform.api.no.annotations.stubs", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 287 | // This one is not on device but it's needed when javac compiles code |
| 288 | // containing lambdas. |
| 289 | "core-lambda-stubs-for-system-modules", |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 290 | ], |
| 291 | } |
Spandan Das | fe85ca2 | 2022-12-08 02:42:25 +0000 | [diff] [blame] | 292 | |
| 293 | // Used when compiling higher-level code against art.module.public.api.stubs. |
| 294 | // This abstraction should come from the inner tree linking against the stubs |
| 295 | // and not from an "sdk", since parts of this abstraction do not belong to an |
| 296 | // official API (e.g. stub-annotations). |
| 297 | // |
| 298 | // This is only intended for use within core libraries and must not be used |
| 299 | // from outside. |
| 300 | java_system_modules { |
| 301 | name: "art-module-public-api-stubs-system-modules", |
| 302 | visibility: [ |
| 303 | "//art/build/sdk", |
| 304 | "//external/conscrypt", |
| 305 | "//external/icu/android_icu4j", |
| 306 | "//external/wycheproof", |
| 307 | ], |
| 308 | libs: [ |
| 309 | "art.module.public.api.stubs", |
| 310 | // This one is not on device but it's needed when javac compiles code |
| 311 | // containing lambdas. |
| 312 | "core-lambda-stubs-for-system-modules", |
Spandan Das | fe85ca2 | 2022-12-08 02:42:25 +0000 | [diff] [blame] | 313 | |
| 314 | // Ensure that core libraries that depend on the public API can access |
| 315 | // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi |
| 316 | // annotations. |
| 317 | "art.module.api.annotations.for.system.modules", |
| 318 | |
| 319 | // Make nullability annotations available when compiling public stubs. |
| 320 | // They are provided as a separate library because while the |
| 321 | // annotations are not themselves part of the public API provided by |
| 322 | // this module they are used in the stubs. |
| 323 | "stub-annotations", |
| 324 | ], |
| 325 | } |
| 326 | |
| 327 | // Used when compiling higher-level code against art.module.public.api.stubs.module_lib. |
| 328 | // |
| 329 | // This is only intended for use within core libraries and must not be used |
| 330 | // from outside. |
| 331 | java_system_modules { |
| 332 | name: "art-module-lib-api-stubs-system-modules", |
| 333 | visibility: [ |
| 334 | "//art/build/sdk", |
| 335 | "//external/conscrypt", |
| 336 | "//external/icu/android_icu4j", |
| 337 | ], |
| 338 | libs: [ |
| 339 | "art.module.public.api.stubs.module_lib", |
| 340 | ], |
| 341 | } |
| 342 | |
| 343 | // Used when compiling against art.module.intra.core.api.stubs. |
| 344 | java_system_modules { |
| 345 | name: "art-module-intra-core-api-stubs-system-modules", |
| 346 | visibility: [ |
| 347 | "//art/build/sdk", |
| 348 | "//external/bouncycastle", |
| 349 | "//external/conscrypt", |
| 350 | "//external/icu/android_icu4j", |
| 351 | ], |
| 352 | libs: [ |
| 353 | // The intra core API stubs library. |
| 354 | "art.module.intra.core.api.stubs", |
| 355 | |
| 356 | // Additional classes needed by javac but which are not present in the stubs. |
| 357 | "art-module-intra-core-api-stubs-system-modules-lib", |
| 358 | ], |
| 359 | } |