1// 2// Copyright (C) 2017 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_visibility: ["//visibility:private"], 19} 20 21//========================================================== 22// build repackaged ICU for target 23// 24// This is done in the libcore/JavaLibraries.mk file as there are circular 25// dependencies between ICU and libcore 26//========================================================== 27filegroup { 28 name: "android_icu4j_public_api_files", 29 visibility: [ 30 "//frameworks/base", 31 ], 32 srcs: [ 33 ":android_icu4j_repackaged_src_files", 34 ], 35 path: "src/main/java", 36} 37 38filegroup { 39 name: "android_icu4j_repackaged_src_files", 40 srcs: ["src/main/java/android/icu/**/*.java"], 41 path: "src/main/java", 42} 43 44// The files contains Android-specific codes to expose intra-core APIs 45// from ICU4J/ICU4C to libcore. The package is com.android.icu.* and should not 46// expose any public APIs. 47filegroup { 48 name: "libcore_icu_bridge_src_files", 49 srcs: ["libcore_bridge/src/java/**/*.java"], 50 path: "libcore_bridge/src/java", 51} 52 53// Rule generating resource lib for android_icu4j. 54// In the downstream branch master-icu-dev, the resource files are generated. 55java_library { 56 name: "android_icu4j_resources_lib", 57 visibility: [ 58 "//libcore", 59 ], 60 java_resource_dirs: ["resources"], 61 sdk_version: "none", 62 system_modules: "none", 63} 64 65// Same as android_icu4j_resources_lib but compiling against core_current sdk 66// in order to avoid using non-public API from core-libart and core-oj 67// because core-icu4j will be in a different i18n APEX module. 68 69java_library { 70 name: "android_icu4j_resources_lib_sdk_core_current", 71 visibility: [ 72 "//libcore", 73 ], 74 java_resource_dirs: ["resources"], 75 sdk_version: "core_current", 76} 77 78// core-repackaged-icu4j contains only the repackaged ICU4J that does not 79// use any internal or android specific code. If it ever did then it could depend on 80// art-module-intra-core-api-stubs-system-modules (a superset) instead. 81// It is important that core-icu4j is restricted to only use stable APIs from the ART module 82// since it is in a different APEX module that can be updated independently. 83java_library_static { 84 name: "core-repackaged-icu4j", 85 installable: false, 86 srcs: [":android_icu4j_repackaged_src_files"], 87 libs: ["unsupportedappusage"], 88 // The resource files are generated in the downstream branch master-icu-dev. 89 java_resource_dirs: ["resources"], 90 91 sdk_version: "none", 92 system_modules: "art-module-public-api-stubs-system-modules", 93 94 dxflags: ["--core-library"], 95 errorprone: { 96 javacflags: [ 97 "-Xep:MissingOverride:OFF", // Ignore missing @Override. 98 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom 99 ], 100 }, 101 102 apex_available: [ 103 "com.android.art.release", 104 "com.android.art.debug", 105 ], 106} 107 108// A separated core library that contains ICU4J because ICU4J will be in a different APEX module, 109// not in ART module. 110java_library { 111 name: "core-icu4j", 112 visibility: [ 113 "//art/build/apex", 114 "//external/robolectric-shadows", 115 "//frameworks/layoutlib", 116 ], 117 apex_available: [ 118 "com.android.art.release", 119 "com.android.art.debug", 120 ], 121 installable: true, 122 hostdex: true, 123 124 srcs: [":libcore_icu_bridge_src_files"], 125 static_libs: ["core-repackaged-icu4j"], 126 127 // It is important that core-icu4j is restricted to only use stable APIs from the ART module 128 // since it is in a different APEX module that can be updated independently. 129 sdk_version: "none", 130 system_modules: "art-module-intra-core-api-stubs-system-modules", 131 132 dxflags: ["--core-library"], 133} 134 135// 136// Guaranteed unstripped versions of core-icu4j. 137// 138// The build system may or may not strip the core-icu4j. jar, 139// but this will not be stripped. See b/24535627. 140// 141java_library { 142 name: "core-icu4j-testdex", 143 installable: true, 144 static_libs: ["core-icu4j"], 145 sdk_version: "none", 146 system_modules: "art-module-public-api-stubs-system-modules", 147 dxflags: ["--core-library"], 148 dex_preopt: { 149 enabled: false, 150 }, 151} 152 153// Generates stubs for the parts of the public SDK API provided by the i18n module. 154// 155// Only for use by i18n.module.public.api.stubs target below. 156droidstubs { 157 name: "i18n-module-public-api-stubs-gen", 158 srcs: [ 159 ":android_icu4j_public_api_files", 160 ], 161 java_version: "1.9", 162 installable: false, 163 sdk_version: "none", 164 system_modules: "art-module-public-api-stubs-system-modules", 165} 166 167// A stubs target containing the parts of the public SDK API provided by the i18n module. 168java_library { 169 name: "i18n.module.public.api.stubs", 170 visibility: [ 171 "//libcore", 172 ], 173 srcs: [":i18n-module-public-api-stubs-gen"], 174 errorprone: { 175 javacflags: [ 176 "-Xep:MissingOverride:OFF", 177 ], 178 }, 179 sdk_version: "none", 180 system_modules: "art-module-public-api-stubs-system-modules", 181} 182 183// Generates stub source files for the intra-core API of the I18N module. 184// i.e. every class/member that is either in the public API or annotated with 185// @IntraCoreApi. 186// 187// The API specification .txt files managed by this only contain the additional 188// classes/members that are in the intra-core API but which are not the public 189// API. 190droidstubs { 191 name: "i18n-module-intra-core-api-stubs-source", 192 visibility: [ 193 // Needed to build core-all as using the compiled library, i.e. 194 // i18n.module.intra.core.api.stubs does not work due to limitations 195 // in javac. 196 "//libcore:__subpackages__", 197 ], 198 srcs: [ 199 ":android_icu4j_repackaged_src_files", 200 ":libcore_icu_bridge_src_files", 201 ], 202 sdk_version: "none", 203 system_modules: "art-module-intra-core-api-stubs-system-modules", 204 205 installable: false, 206 args: "--hide-annotation libcore.api.Hide " + 207 "--show-single-annotation libcore.api.IntraCoreApi " + 208 "--skip-annotation-instance-methods=false ", 209 210 api_filename: "api.txt", 211 removed_api_filename: "removed.txt", 212 previous_api: "previous.txt", 213 check_api: { 214 current: { 215 api_file: "api/intra/current-api.txt", 216 removed_api_file: "api/intra/current-removed.txt", 217 }, 218 last_released: { 219 api_file: "api/intra/last-api.txt", 220 removed_api_file: "api/intra/last-removed.txt", 221 }, 222 }, 223} 224 225// A library containing the intra-core API stubs of the I18N module. 226// 227// Intra-core APIs are only intended for the use of other core library modules. 228java_library { 229 name: "i18n.module.intra.core.api.stubs", 230 visibility: [ 231 "//libcore:__subpackages__", 232 ], 233 srcs: [ 234 ":i18n-module-intra-core-api-stubs-source", 235 ], 236 237 sdk_version: "none", 238 system_modules: "art-module-intra-core-api-stubs-system-modules", 239} 240 241// Generates stub source files for the core platform API of the I18N module. 242// i.e. every class/member that is either in the public API or annotated with 243// @CorePlatformApi. 244// 245// The API specification .txt files managed by this only contain the additional 246// classes/members that are in the intra-core API but which are not in the public 247// API. 248droidstubs { 249 name: "i18n-module-platform-api-stubs-source", 250 srcs: [ 251 ":android_icu4j_repackaged_src_files", 252 ":libcore_icu_bridge_src_files", 253 ], 254 sdk_version: "none", 255 system_modules: "art-module-platform-api-stubs-system-modules", 256 257 installable: false, 258 args: "--hide-annotation libcore.api.Hide " + 259 "--show-single-annotation libcore.api.CorePlatformApi " + 260 "--skip-annotation-instance-methods=false ", 261 262 api_filename: "api.txt", 263 removed_api_filename: "removed.txt", 264 previous_api: "previous.txt", 265 266 check_api: { 267 current: { 268 api_file: "api/platform/current-api.txt", 269 removed_api_file: "api/platform/current-removed.txt", 270 }, 271 last_released: { 272 api_file: "api/platform/last-api.txt", 273 removed_api_file: "api/platform/last-removed.txt", 274 }, 275 }, 276} 277 278// A library containing the core platform API stubs of the I18N module. 279// 280// Core platform APIs are only intended for use of other parts of the platform, not the 281// core library modules. 282java_library { 283 name: "i18n.module.platform.api.stubs", 284 visibility: [ 285 "//libcore:__subpackages__", 286 ], 287 srcs: [ 288 ":i18n-module-platform-api-stubs-source", 289 ], 290 hostdex: true, 291 292 sdk_version: "none", 293 system_modules: "art-module-platform-api-stubs-system-modules", 294} 295 296//========================================================== 297// build repackaged ICU tests 298// 299// Target builds against core-libart and core-oj so that it can access all the 300// repackaged android.icu classes and methods and not just the ones available 301// through the Android API. 302//========================================================== 303java_test { 304 name: "android-icu4j-tests", 305 visibility: [ 306 "//cts/tests/tests/icu", 307 ], 308 309 srcs: [ 310 "src/main/tests/**/*.java", 311 "testing/src/**/*.java", 312 ], 313 java_resource_dirs: [ 314 "src/main/tests", 315 "testing/src", 316 ], 317 libs: [ 318 "core-icu4j", 319 ], 320 static_libs: [ 321 "junit", 322 "junit-params", 323 ], 324 325 patch_module: "java.base", 326 sdk_version: "none", 327 system_modules: "art-module-intra-core-api-stubs-system-modules", 328} 329