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", |
| 66 | // This one is not on device but it's needed when javac compiles code |
| 67 | // containing @Generated annotations produced by some code generation |
| 68 | // tools. |
| 69 | // See http://b/123891440. |
| 70 | "core-generated-annotation-stubs", |
| 71 | ], |
| 72 | sdk_version: "none", |
| 73 | system_modules: "none", |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame^] | 74 | dists: [ |
| 75 | { |
| 76 | // Legacy dist location for the public file. |
| 77 | dest: "core-for-system-modules.jar", |
| 78 | targets: dist_targets, |
| 79 | }, |
| 80 | { |
| 81 | dest: "system-modules/public/core-for-system-modules.jar", |
| 82 | targets: dist_targets, |
| 83 | }, |
| 84 | ], |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | // Used when compiling higher-level code against core.current.stubs. |
| 88 | java_system_modules { |
| 89 | name: "core-current-stubs-system-modules", |
| 90 | visibility: ["//visibility:public"], |
| 91 | libs: [ |
| 92 | "core-current-stubs-for-system-modules", |
| 93 | ], |
| 94 | } |
| 95 | |
| 96 | // A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API |
| 97 | // provided by the core libraries. |
| 98 | // |
| 99 | // Don't use this directly, use "sdk_version: module_current". |
| 100 | java_library { |
| 101 | name: "core.module_lib.stubs", |
| 102 | static_libs: [ |
| 103 | "art.module.public.api.stubs.module_lib", |
| 104 | |
| 105 | // Replace the following with the module-lib correspondence when Conscrypt or i18N module |
| 106 | // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides |
| 107 | // @SystemApi(MODULE_LIBRARIES). |
| 108 | "conscrypt.module.public.api.stubs", |
| 109 | "i18n.module.public.api.stubs", |
| 110 | ], |
| 111 | sdk_version: "none", |
| 112 | system_modules: "none", |
| 113 | visibility: ["//visibility:private"], |
| 114 | } |
| 115 | |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame^] | 116 | // Produces a dist file that is used by the |
| 117 | // prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk |
| 118 | // directory. |
| 119 | java_library { |
| 120 | name: "core-module-lib-stubs-for-system-modules", |
| 121 | visibility: ["//visibility:private"], |
| 122 | static_libs: [ |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 123 | "core.module_lib.stubs", |
| 124 | // This one is not on device but it's needed when javac compiles code |
| 125 | // containing lambdas. |
| 126 | "core-lambda-stubs-for-system-modules", |
| 127 | // This one is not on device but it's needed when javac compiles code |
| 128 | // containing @Generated annotations produced by some code generation |
| 129 | // tools. |
| 130 | // See http://b/123891440. |
| 131 | "core-generated-annotation-stubs", |
| 132 | ], |
Paul Duffin | bce9f08 | 2021-10-28 12:34:41 +0100 | [diff] [blame^] | 133 | sdk_version: "none", |
| 134 | system_modules: "none", |
| 135 | dist: { |
| 136 | dest: "system-modules/module-lib/core-for-system-modules.jar", |
| 137 | targets: dist_targets, |
| 138 | }, |
| 139 | } |
| 140 | |
| 141 | // Used when compiling higher-level code with sdk_version "module_current" |
| 142 | java_system_modules { |
| 143 | name: "core-module-lib-stubs-system-modules", |
| 144 | libs: [ |
| 145 | "core-module-lib-stubs-for-system-modules", |
| 146 | ], |
Paul Duffin | bb360c3 | 2021-07-10 23:31:50 +0100 | [diff] [blame] | 147 | visibility: ["//visibility:public"], |
| 148 | } |
| 149 | |
| 150 | // Ideally this should be a restricted allowlist but there are hundreds of modules that depend on |
| 151 | // this. |
| 152 | // TODO(http://b/134561230) - limit the number of dependents on this. |
| 153 | core_platform_visibility = ["//visibility:public"] |
| 154 | |
| 155 | // Libraries containing the core platform API stubs for the core libraries. |
| 156 | // |
| 157 | // Although this stubs library is primarily used by the Java compiler / build to indicate |
| 158 | // the core platform API surface area, compile_dex: true is used so that the Core Platform |
| 159 | // API annotations are available to the dex tools that enable enforcement of runtime |
| 160 | // accessibility. b/119068555 |
| 161 | java_library { |
| 162 | name: "legacy.core.platform.api.stubs", |
| 163 | visibility: core_platform_visibility, |
| 164 | hostdex: true, |
| 165 | compile_dex: true, |
| 166 | |
| 167 | sdk_version: "none", |
| 168 | system_modules: "none", |
| 169 | static_libs: [ |
| 170 | "art.module.public.api.stubs.module_lib", |
| 171 | "conscrypt.module.platform.api.stubs", |
| 172 | "legacy.i18n.module.platform.api.stubs", |
| 173 | ], |
| 174 | patch_module: "java.base", |
| 175 | } |
| 176 | |
| 177 | java_library { |
| 178 | name: "stable.core.platform.api.stubs", |
| 179 | visibility: core_platform_visibility, |
| 180 | hostdex: true, |
| 181 | compile_dex: true, |
| 182 | |
| 183 | sdk_version: "none", |
| 184 | system_modules: "none", |
| 185 | static_libs: [ |
| 186 | "art.module.public.api.stubs.module_lib", |
| 187 | // conscrypt only has a stable version, so it is okay to depend on it here: |
| 188 | "conscrypt.module.platform.api.stubs", |
| 189 | "stable.i18n.module.platform.api.stubs", |
| 190 | ], |
| 191 | patch_module: "java.base", |
| 192 | } |
| 193 | |
| 194 | // Used when compiling higher-level code against *.core.platform.api.stubs. |
| 195 | java_system_modules { |
| 196 | name: "legacy-core-platform-api-stubs-system-modules", |
| 197 | visibility: core_platform_visibility, |
| 198 | libs: [ |
| 199 | "legacy.core.platform.api.stubs", |
| 200 | // This one is not on device but it's needed when javac compiles code |
| 201 | // containing lambdas. |
| 202 | "core-lambda-stubs-for-system-modules", |
| 203 | // This one is not on device but it's needed when javac compiles code |
| 204 | // containing @Generated annotations produced by some code generation |
| 205 | // tools. |
| 206 | // See http://b/123891440. |
| 207 | "core-generated-annotation-stubs", |
| 208 | ], |
| 209 | } |
| 210 | |
| 211 | java_system_modules { |
| 212 | name: "stable-core-platform-api-stubs-system-modules", |
| 213 | visibility: core_platform_visibility, |
| 214 | libs: [ |
| 215 | "stable.core.platform.api.stubs", |
| 216 | // This one is not on device but it's needed when javac compiles code |
| 217 | // containing lambdas. |
| 218 | "core-lambda-stubs-for-system-modules", |
| 219 | // This one is not on device but it's needed when javac compiles code |
| 220 | // containing @Generated annotations produced by some code generation |
| 221 | // tools. |
| 222 | // See http://b/123891440. |
| 223 | "core-generated-annotation-stubs", |
| 224 | ], |
| 225 | } |