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 // See: http://go/android-license-faq 20 // A large-scale-change added 'default_applicable_licenses' to import 21 // all of the 'license_kinds' from "external_icu_license" 22 // to get the below license kinds: 23 // SPDX-license-identifier-Apache-2.0 24 // SPDX-license-identifier-BSD 25 // SPDX-license-identifier-ICU 26 // SPDX-license-identifier-MIT 27 // SPDX-license-identifier-Unicode-DFS 28 // legacy_unencumbered 29 default_applicable_licenses: ["external_icu_license"], 30} 31 32//========================================================== 33// build repackaged ICU for target 34// 35// This is done in the libcore/JavaLibraries.mk file as there are circular 36// dependencies between ICU and libcore 37//========================================================== 38filegroup { 39 name: "android_icu4j_public_api_files", 40 srcs: [ 41 ":android_icu4j_repackaged_src_files", 42 ], 43 path: "src/main/java", 44} 45 46filegroup { 47 name: "android_icu4j_repackaged_src_files", 48 srcs: ["src/main/java/android/icu/**/*.java"], 49 path: "src/main/java", 50} 51 52// The files contains Android-specific codes to expose intra-core APIs 53// from ICU4J/ICU4C to libcore or core platform APIs to the framework. 54// The package is com.android.icu.* and should not expose any public APIs. 55filegroup { 56 name: "libcore_icu_bridge_src_files", 57 srcs: ["libcore_bridge/src/java/**/*.java"], 58 path: "libcore_bridge/src/java", 59} 60 61java_defaults { 62 name: "libcore_icu_bridge_defaults", 63 srcs: [ 64 "libcore_bridge/src/java/**/*.java", 65 ":app-compat-annotations-source", 66 ], 67 jarjar_rules: "jarjar-rules.txt", 68 plugins: [ 69 "compat-changeid-annotation-processor", 70 ], 71} 72 73// A host library containing time zone related classes. Used for 74// host-side tools and tests that have to deal with Android 75// time zone data. 76java_library_host { 77 name: "timezone-host", 78 visibility: [ 79 "//packages/modules/RuntimeI18n/apex", 80 "//system/timezone/distro/core", 81 ], 82 srcs: [ 83 "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java", 84 ], 85 libs: [ 86 "art.module.api.annotations", 87 ], 88} 89 90// core-repackaged-icu4j contains only the repackaged ICU4J that does not 91// use any internal or android specific code. If it ever did then it could depend on 92// art-module-intra-core-api-stubs-system-modules (a superset) instead. 93// It is important that core-icu4j is restricted to only use stable APIs from the ART module 94// since it is in a different APEX module that can be updated independently. 95java_library_static { 96 name: "core-repackaged-icu4j", 97 installable: false, 98 srcs: [":android_icu4j_repackaged_src_files"], 99 libs: ["unsupportedappusage"], 100 // The resource files are generated in the downstream branch master-icu-dev. 101 java_resource_dirs: ["resources"], 102 103 sdk_version: "none", 104 system_modules: "art-module-public-api-stubs-system-modules", 105 106 dxflags: ["--core-library"], 107 apex_available: [ 108 "com.android.i18n", 109 ], 110 errorprone: { 111 javacflags: [ 112 "-Xep:MissingOverride:OFF", // Ignore missing @Override. 113 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom 114 ], 115 }, 116} 117 118// A separated core library that contains ICU4J because ICU4J will be in a different APEX module, 119// not in ART module. 120java_library { 121 name: "core-icu4j", 122 defaults: ["libcore_icu_bridge_defaults"], 123 visibility: [ 124 "//packages/modules/RuntimeI18n/apex", 125 ], 126 apex_available: [ 127 "com.android.i18n", 128 ], 129 permitted_packages: [ 130 "android.icu", 131 "com.android.icu", 132 "com.android.i18n.system", 133 "com.android.i18n.timezone", 134 "com.android.i18n.util", 135 ], 136 installable: true, 137 hostdex: false, 138 139 static_libs: ["core-repackaged-icu4j"], 140 141 // It is important that core-icu4j is restricted to only use stable APIs from the ART module 142 // since it is in a different APEX module that can be updated independently. 143 sdk_version: "none", 144 system_modules: "art-module-intra-core-api-stubs-system-modules", 145 146 dxflags: ["--core-library"], 147} 148 149// Java library for use on host, e.g. by robolectric. 150java_library { 151 name: "core-icu4j-for-host", 152 visibility: [ 153 "//art/build", 154 "//external/robolectric", 155 "//external/robolectric-shadows", 156 "//frameworks/layoutlib", 157 "//packages/modules/RuntimeI18n/apex", 158 ], 159 static_libs: [ 160 "core-icu4j", 161 ], 162 sdk_version: "none", 163 system_modules: "none", 164} 165 166platform_compat_config { 167 name: "icu4j-platform-compat-config", 168 src: ":core-icu4j", 169} 170 171java_sdk_library { 172 name: "i18n.module.public.api", 173 visibility: [ 174 "//build/soong/java/core-libraries", 175 "//frameworks/base", 176 "//frameworks/base/api", 177 "//packages/modules/RuntimeI18n/apex", 178 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 179 // this module. 180 // TODO(b/155921753): Restrict this when prebuilts are in their proper 181 // locations. 182 "//prebuilts:__subpackages__", 183 ], 184 srcs: [ 185 ":android_icu4j_public_api_files", 186 ], 187 droiddoc_options: [ 188 "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ", 189 ], 190 errorprone: { 191 javacflags: [ 192 "-Xep:MissingOverride:OFF", 193 ], 194 }, 195 196 public: { 197 enabled: true, 198 }, 199 system: { 200 enabled: true, 201 }, 202 module_lib: { 203 enabled: true, 204 }, 205 206 api_dir: "api/public", 207 api_only: true, 208 209 // Emit nullability annotations from the source to the stub files. 210 annotations_enabled: true, 211 212 sdk_version: "none", 213 system_modules: "art-module-public-api-stubs-system-modules", 214 215 // The base name for the artifacts that are automatically published to the 216 // dist and which end up in one of the sub-directories of prebuilts/sdk. 217 // As long as this matches the name of the artifacts in prebuilts/sdk then 218 // the API will be checked for compatibility against the latest released 219 // version of the API. 220 dist_stem: "runtime-i18n", 221 dist_group: "android", 222} 223 224// Generates stub source files for the intra-core API of the I18N module. 225// i.e. every class/member that is either in the public API or annotated with 226// @IntraCoreApi. 227// 228// The API specification .txt files managed by this only contain the additional 229// classes/members that are in the intra-core API but which are not the public 230// API. 231java_sdk_library { 232 name: "i18n.module.intra.core.api", 233 defaults: ["libcore_icu_bridge_defaults"], 234 srcs: [ 235 ":android_icu4j_repackaged_src_files", 236 ], 237 visibility: [ 238 "//libcore:__subpackages__", 239 "//packages/modules/RuntimeI18n/apex", 240 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 241 // this module. 242 // TODO(b/155921753): Restrict this when prebuilts are in their proper 243 // locations. 244 "//prebuilts:__subpackages__", 245 ], 246 api_dir: "api/intra", 247 api_only: true, 248 sdk_version: "none", 249 system_modules: "art-module-intra-core-api-stubs-system-modules", 250 251 droiddoc_options: [ 252 "--hide-annotation libcore.api.Hide ", 253 "--show-single-annotation libcore.api.IntraCoreApi ", 254 ], 255 256 // Don't copy any output files to the dist. 257 no_dist: true, 258} 259 260// Referenced implicitly from i18n.module.intra.core.api. 261filegroup { 262 name: "i18n.module.intra.core.api.api.public.latest", 263 srcs: [ 264 "api/intra/last-api.txt", 265 ], 266} 267 268// Referenced implicitly from i18n.module.intra.core.api. 269filegroup { 270 name: "i18n.module.intra.core.api-removed.api.public.latest", 271 srcs: [ 272 "api/intra/last-removed.txt", 273 ], 274} 275 276// Referenced implicitly from i18n.module.intra.core.api. 277filegroup { 278 name: "i18n.module.intra.core.api-incompatibilities.api.public.latest", 279 srcs: [ 280 "api/intra/last-incompatibilities.txt", 281 ], 282} 283 284// Referenced implicitly from legacy.i18n.module.platform.api. 285filegroup { 286 name: "legacy.i18n.module.platform.api.api.public.latest", 287 srcs: [ 288 "api/legacy_platform/last-api.txt", 289 ], 290} 291 292// Referenced implicitly from legacy.i18n.module.platform.api. 293filegroup { 294 name: "legacy.i18n.module.platform.api-removed.api.public.latest", 295 srcs: [ 296 "api/legacy_platform/last-removed.txt", 297 ], 298} 299 300// Referenced implicitly from legacy.i18n.module.platform.api. 301filegroup { 302 name: "legacy.i18n.module.platform.api-incompatibilities.api.public.latest", 303 srcs: [ 304 "api/legacy_platform/last-incompatibilities.txt", 305 ], 306} 307 308// Referenced implicitly from stable.i18n.module.platform.api. 309filegroup { 310 name: "stable.i18n.module.platform.api.api.public.latest", 311 srcs: [ 312 "api/stable_platform/last-api.txt", 313 ], 314} 315 316// Referenced implicitly from stable.i18n.module.platform.api. 317filegroup { 318 name: "stable.i18n.module.platform.api-removed.api.public.latest", 319 srcs: [ 320 "api/stable_platform/last-removed.txt", 321 ], 322} 323 324// Referenced implicitly from stable.i18n.module.platform.api. 325filegroup { 326 name: "stable.i18n.module.platform.api-incompatibilities.api.public.latest", 327 srcs: [ 328 "api/stable_platform/last-incompatibilities.txt", 329 ], 330} 331 332// Generates stub source files for the core platform API of the I18N module. 333// i.e. every class/member that is either in the public API or annotated with 334// @CorePlatformApi. 335// 336// The API specification .txt files managed by this only contain the additional 337// classes/members that are in the intra-core API but which are not in the public 338// API. 339// 340// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp. 341 342java_sdk_library { 343 name: "legacy.i18n.module.platform.api", 344 defaults: ["libcore_icu_bridge_defaults"], 345 srcs: [ 346 ":android_icu4j_repackaged_src_files", 347 ], 348 visibility: [ 349 "//build/soong/java/core-libraries", 350 "//packages/modules/RuntimeI18n/apex", 351 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 352 // this module. 353 // TODO(b/155921753): Restrict this when prebuilts are in their proper 354 // locations. 355 "//prebuilts:__subpackages__", 356 ], 357 hostdex: true, 358 api_dir: "api/legacy_platform", 359 api_only: true, 360 sdk_version: "none", 361 system_modules: "art-module-lib-api-stubs-system-modules", 362 363 droiddoc_options: [ 364 "--hide-annotation libcore.api.Hide ", 365 "--show-single-annotation libcore.api.CorePlatformApi ", 366 ], 367 368 // Don't copy any output files to the dist. 369 no_dist: true, 370} 371 372java_sdk_library { 373 name: "stable.i18n.module.platform.api", 374 defaults: ["libcore_icu_bridge_defaults"], 375 srcs: [ 376 ":android_icu4j_repackaged_src_files", 377 ], 378 visibility: [ 379 "//build/soong/java/core-libraries", 380 "//packages/modules/RuntimeI18n/apex", 381 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 382 // this module. 383 // TODO(b/155921753): Restrict this when prebuilts are in their proper 384 // locations. 385 "//prebuilts:__subpackages__", 386 ], 387 hostdex: true, 388 api_dir: "api/stable_platform", 389 api_only: true, 390 sdk_version: "none", 391 system_modules: "art-module-lib-api-stubs-system-modules", 392 393 droiddoc_options: [ 394 "--hide-annotation libcore.api.Hide ", 395 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)", 396 ], 397 398 // Don't copy any output files to the dist. 399 no_dist: true, 400} 401 402//========================================================== 403// build repackaged ICU tests 404// 405// Target builds against core-libart and core-oj so that it can access all the 406// repackaged android.icu classes and methods and not just the ones available 407// through the Android API. 408//========================================================== 409java_test { 410 name: "android-icu4j-tests", 411 visibility: [ 412 "//cts/tests/tests/icu", 413 ], 414 415 srcs: [ 416 "src/main/tests/**/*.java", 417 "testing/src/**/*.java", 418 ], 419 java_resource_dirs: [ 420 "src/main/tests", 421 "testing/src", 422 ], 423 libs: [ 424 "core-icu4j", 425 ], 426 static_libs: [ 427 "junit", 428 "junit-params", 429 "tzdata-testing", 430 ], 431 432 patch_module: "java.base", 433 sdk_version: "none", 434 system_modules: "art-module-intra-core-api-stubs-system-modules", 435 436 errorprone: { 437 javacflags: ["-Xep:EqualsNull:WARN"], 438 }, 439} 440