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_team: "trendy_team_java_core_libraries", 19 default_visibility: ["//visibility:private"], 20 // See: http://go/android-license-faq 21 // A large-scale-change added 'default_applicable_licenses' to import 22 // all of the 'license_kinds' from "external_icu_license" 23 // to get the below license kinds: 24 // SPDX-license-identifier-Apache-2.0 25 // SPDX-license-identifier-BSD 26 // SPDX-license-identifier-ICU 27 // SPDX-license-identifier-MIT 28 // SPDX-license-identifier-Unicode-DFS 29 // legacy_unencumbered 30 default_applicable_licenses: ["external_icu_license"], 31} 32 33//========================================================== 34// build repackaged ICU for target 35// 36// This is done in the libcore/JavaLibraries.mk file as there are circular 37// dependencies between ICU and libcore 38//========================================================== 39filegroup { 40 name: "android_icu4j_public_api_files", 41 srcs: [ 42 ":android_icu4j_repackaged_src_files", 43 ], 44 path: "src/main/java", 45} 46 47filegroup { 48 name: "android_icu4j_repackaged_src_files", 49 srcs: ["src/main/java/android/icu/**/*.java"], 50 path: "src/main/java", 51} 52 53// The files contains Android-specific codes to expose intra-core APIs 54// from ICU4J/ICU4C to libcore or core platform APIs to the framework. 55// The package is com.android.icu.* and should not expose any public APIs. 56filegroup { 57 name: "libcore_icu_bridge_src_files", 58 srcs: ["libcore_bridge/src/java/**/*.java"], 59 path: "libcore_bridge/src/java", 60} 61 62java_defaults { 63 name: "libcore_icu_bridge_defaults", 64 srcs: [ 65 "libcore_bridge/src/java/**/*.java", 66 ":app-compat-annotations-source", 67 ], 68 jarjar_rules: "jarjar-rules.txt", 69 plugins: [ 70 "compat-changeid-annotation-processor", 71 ], 72} 73 74// A host library containing time zone related classes. Used for 75// host-side tools and tests that have to deal with Android 76// time zone data. 77java_library_host { 78 name: "timezone-host", 79 visibility: [ 80 "//packages/modules/RuntimeI18n/apex", 81 "//system/timezone/input_tools/version", 82 ], 83 srcs: [ 84 "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java", 85 ], 86 libs: [ 87 "art.module.api.annotations", 88 ], 89} 90 91// core-repackaged-icu4j contains only the repackaged ICU4J that does not 92// use any internal or android specific code. If it ever did then it could depend on 93// art-module-intra-core-api-stubs-system-modules (a superset) instead. 94// It is important that core-icu4j is restricted to only use stable APIs from the ART module 95// since it is in a different APEX module that can be updated independently. 96java_library_static { 97 name: "core-repackaged-icu4j", 98 installable: false, 99 srcs: [":android_icu4j_repackaged_src_files"], 100 // The resource files are generated in the downstream branch master-icu-dev. 101 java_resource_dirs: ["resources"], 102 libs: [ 103 "unsupportedappusage", 104 // Need framework-api-annotations-lib for @FlaggedApi. 105 // Put framework-api-annotations into libs to avoid exposing the definition of framework's 106 // annotations from ICU (wrong place) instead of framework (correct place). 107 "framework-annotations-lib", 108 ], 109 static_libs: [ 110 "icu_aconfig_flags_lib", 111 ], 112 113 sdk_version: "none", 114 system_modules: "art-module-public-api-stubs-system-modules", 115 116 dxflags: ["--core-library"], 117 apex_available: [ 118 "com.android.i18n", 119 ], 120 errorprone: { 121 javacflags: [ 122 "-Xep:MissingOverride:OFF", // Ignore missing @Override. 123 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom 124 "-Xep:BoxedPrimitiveEquality:WARN", 125 "-Xep:ComparableType:WARN", 126 "-Xep:EmptyTopLevelDeclaration:WARN", 127 ], 128 }, 129 lint: { 130 warning_checks: ["SuspiciousIndentation"], 131 baseline_filename: "lint-baseline.xml", 132 }, 133} 134 135// A separated core library that contains ICU4J because ICU4J will be in a different APEX module, 136// not in ART module. 137java_library { 138 name: "core-icu4j", 139 defaults: ["libcore_icu_bridge_defaults"], 140 visibility: [ 141 "//art/tools/fuzzer", 142 "//packages/modules/RuntimeI18n/apex", 143 ], 144 apex_available: [ 145 "com.android.i18n", 146 ], 147 permitted_packages: [ 148 "android.icu", 149 "com.android.icu", 150 "com.android.i18n.system", 151 "com.android.i18n.timezone", 152 "com.android.i18n.util", 153 ], 154 installable: true, 155 hostdex: false, 156 157 libs: [ 158 "framework-annotations-lib", 159 ], 160 static_libs: ["core-repackaged-icu4j"], 161 162 // It is important that core-icu4j is restricted to only use stable APIs from the ART module 163 // since it is in a different APEX module that can be updated independently. 164 sdk_version: "none", 165 system_modules: "art-module-intra-core-api-stubs-system-modules", 166 167 dxflags: ["--core-library"], 168} 169 170// Java library for use on host, e.g. by ravenwood, robolectric. 171java_library { 172 name: "core-icu4j-for-host", 173 visibility: [ 174 "//art/build", 175 "//external/robolectric", 176 "//external/robolectric-shadows", 177 "//frameworks/layoutlib", 178 "//frameworks/base/ravenwood:__subpackages__", 179 "//packages/modules/RuntimeI18n/apex", 180 ], 181 static_libs: [ 182 "core-icu4j", 183 ], 184 sdk_version: "none", 185 system_modules: "none", 186} 187 188platform_compat_config { 189 name: "icu4j-platform-compat-config", 190 src: ":core-icu4j", 191 visibility: [ 192 "//frameworks/base", 193 ], 194} 195 196java_sdk_library { 197 name: "i18n.module.public.api", 198 visibility: [ 199 "//build/soong/java/core-libraries", 200 "//frameworks/base", 201 "//frameworks/base/api", 202 "//packages/modules/RuntimeI18n/apex", 203 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 204 // this module. 205 // TODO(b/155921753): Restrict this when prebuilts are in their proper 206 // locations. 207 "//prebuilts:__subpackages__", 208 ], 209 // Added to make sure that no private classes leak out in stubs. 210 defaults: ["libcore_icu_bridge_defaults"], 211 srcs: [ 212 // Added to make sure that no private classes leak out in stubs. 213 ":android_icu4j_repackaged_src_files", 214 ":android_icu4j_public_api_files", 215 ], 216 libs: [ 217 "icu_aconfig_flags_lib", 218 ], 219 droiddoc_options: [ 220 "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ", 221 ], 222 errorprone: { 223 javacflags: [ 224 "-Xep:MissingOverride:OFF", 225 ], 226 }, 227 lint: { 228 warning_checks: ["SuspiciousIndentation"], 229 }, 230 231 public: { 232 enabled: true, 233 }, 234 system: { 235 enabled: true, 236 }, 237 module_lib: { 238 enabled: true, 239 }, 240 241 api_dir: "api/public", 242 api_only: true, 243 244 // Emit nullability annotations from the source to the stub files. 245 annotations_enabled: true, 246 247 sdk_version: "none", 248 system_modules: "art-module-public-api-stubs-system-modules", 249 250 // The base name for the artifacts that are automatically published to the 251 // dist and which end up in one of the sub-directories of prebuilts/sdk. 252 // As long as this matches the name of the artifacts in prebuilts/sdk then 253 // the API will be checked for compatibility against the latest released 254 // version of the API. 255 dist_stem: "runtime-i18n", 256 dist_group: "android", 257 aconfig_declarations: [ 258 "icu_aconfig_flags", 259 ], 260} 261 262// Generates stub source files for the intra-core API of the I18N module. 263// i.e. every class/member that is either in the public API or annotated with 264// @IntraCoreApi. 265// 266// The API specification .txt files managed by this only contain the additional 267// classes/members that are in the intra-core API but which are not the public 268// API. 269java_sdk_library { 270 name: "i18n.module.intra.core.api", 271 defaults: ["libcore_icu_bridge_defaults"], 272 srcs: [ 273 ":android_icu4j_repackaged_src_files", 274 ], 275 stub_only_libs: [ 276 "stub-annotations", 277 ], 278 visibility: [ 279 "//libcore:__subpackages__", 280 "//packages/modules/RuntimeI18n/apex", 281 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 282 // this module. 283 // TODO(b/155921753): Restrict this when prebuilts are in their proper 284 // locations. 285 "//prebuilts:__subpackages__", 286 ], 287 api_dir: "api/intra", 288 api_only: true, 289 290 // Emit nullability annotations from the source to the stub files. 291 annotations_enabled: true, 292 293 sdk_version: "none", 294 system_modules: "art-module-intra-core-api-stubs-system-modules", 295 296 droiddoc_options: [ 297 "--hide-annotation libcore.api.Hide ", 298 "--show-single-annotation libcore.api.IntraCoreApi ", 299 // Exclude FlaggedApi as Metalava cannot resolve the flags reference 300 // because this is not given the flags library on the classpath as 301 // doing so creates a cycle. 302 "--exclude-annotation android.annotation.FlaggedApi", 303 ], 304 305 public: { 306 // Select api-surface defined in build/soong/java/metalava/main-config.xml 307 api_surface: "intra-core", 308 }, 309 310 // Don't copy any output files to the dist. 311 no_dist: true, 312 313 lint: { 314 warning_checks: ["SuspiciousIndentation"], 315 }, 316 317 // This module's output stubs contain apis defined in "i18n.module.public.api.stubs", 318 // but adding "i18n.module.public.api" as a dependency of this module leads to circular 319 // dependency and requires further bootstrapping. Thus, disable stubs generation from the 320 // api signature files and generate stubs from the source Java files instead. 321 build_from_text_stub: false, 322} 323 324// Referenced implicitly from i18n.module.intra.core.api. 325filegroup { 326 name: "i18n.module.intra.core.api.api.combined.public.latest", 327 srcs: [ 328 "api/intra/last-api.txt", 329 ], 330} 331 332// Referenced implicitly from i18n.module.intra.core.api. 333filegroup { 334 name: "i18n.module.intra.core.api-removed.api.combined.public.latest", 335 srcs: [ 336 "api/intra/last-removed.txt", 337 ], 338} 339 340// Referenced implicitly from i18n.module.intra.core.api. 341filegroup { 342 name: "i18n.module.intra.core.api-incompatibilities.api.public.latest", 343 srcs: [ 344 "api/intra/last-incompatibilities.txt", 345 ], 346} 347 348// Referenced implicitly from legacy.i18n.module.platform.api. 349filegroup { 350 name: "legacy.i18n.module.platform.api.api.combined.public.latest", 351 srcs: [ 352 "api/legacy_platform/last-api.txt", 353 ], 354} 355 356// Referenced implicitly from legacy.i18n.module.platform.api. 357filegroup { 358 name: "legacy.i18n.module.platform.api-removed.api.combined.public.latest", 359 srcs: [ 360 "api/legacy_platform/last-removed.txt", 361 ], 362} 363 364// Referenced implicitly from legacy.i18n.module.platform.api. 365filegroup { 366 name: "legacy.i18n.module.platform.api-incompatibilities.api.public.latest", 367 srcs: [ 368 "api/legacy_platform/last-incompatibilities.txt", 369 ], 370} 371 372// Referenced implicitly from stable.i18n.module.platform.api. 373filegroup { 374 name: "stable.i18n.module.platform.api.api.combined.public.latest", 375 srcs: [ 376 "api/stable_platform/last-api.txt", 377 ], 378} 379 380// Referenced implicitly from stable.i18n.module.platform.api. 381filegroup { 382 name: "stable.i18n.module.platform.api-removed.api.combined.public.latest", 383 srcs: [ 384 "api/stable_platform/last-removed.txt", 385 ], 386} 387 388// Referenced implicitly from stable.i18n.module.platform.api. 389filegroup { 390 name: "stable.i18n.module.platform.api-incompatibilities.api.public.latest", 391 srcs: [ 392 "api/stable_platform/last-incompatibilities.txt", 393 ], 394} 395 396// Used by ravenwood for processing 397filegroup { 398 name: "icu-ravenwood-policies", 399 visibility: ["//frameworks/base/ravenwood"], 400 srcs: [ 401 "icu-ravenwood-policies.txt", 402 ], 403} 404 405// Generates stub source files for the core platform API of the I18N module. 406// i.e. every class/member that is either in the public API or annotated with 407// @CorePlatformApi. 408// 409// The API specification .txt files managed by this only contain the additional 410// classes/members that are in the intra-core API but which are not in the public 411// API. 412// 413// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp. 414 415java_sdk_library { 416 name: "legacy.i18n.module.platform.api", 417 defaults: ["libcore_icu_bridge_defaults"], 418 srcs: [ 419 ":android_icu4j_repackaged_src_files", 420 ], 421 visibility: [ 422 "//build/soong/java/core-libraries", 423 "//packages/modules/RuntimeI18n/apex", 424 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 425 // this module. 426 // TODO(b/155921753): Restrict this when prebuilts are in their proper 427 // locations. 428 "//prebuilts:__subpackages__", 429 // We need to know what major version of tzdata a device needs. 430 "//system/timezone/apex/tests", 431 ], 432 hostdex: true, 433 api_dir: "api/legacy_platform", 434 api_only: true, 435 sdk_version: "none", 436 system_modules: "art-module-lib-api-stubs-system-modules", 437 438 public: { 439 // Select api-surface defined in build/soong/java/metalava/main-config.xml 440 api_surface: "core-platform-legacy", 441 }, 442 443 droiddoc_options: [ 444 "--hide-annotation libcore.api.Hide ", 445 "--show-single-annotation libcore.api.CorePlatformApi ", 446 ], 447 448 libs: [ 449 "icu_aconfig_flags_lib", 450 ], 451 452 // Don't copy any output files to the dist. 453 no_dist: true, 454 455 lint: { 456 warning_checks: ["SuspiciousIndentation"], 457 }, 458} 459 460java_sdk_library { 461 name: "stable.i18n.module.platform.api", 462 defaults: ["libcore_icu_bridge_defaults"], 463 srcs: [ 464 ":android_icu4j_repackaged_src_files", 465 ], 466 visibility: [ 467 "//build/soong/java/core-libraries", 468 "//packages/modules/RuntimeI18n/apex", 469 // Visibility for prebuilt i18n-module-sdk from the prebuilt of 470 // this module. 471 // TODO(b/155921753): Restrict this when prebuilts are in their proper 472 // locations. 473 "//prebuilts:__subpackages__", 474 ], 475 hostdex: true, 476 api_dir: "api/stable_platform", 477 api_only: true, 478 sdk_version: "none", 479 system_modules: "art-module-lib-api-stubs-system-modules", 480 481 droiddoc_options: [ 482 "--hide-annotation libcore.api.Hide ", 483 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)", 484 ], 485 486 public: { 487 // Select api-surface defined in build/soong/java/metalava/main-config.xml 488 api_surface: "core-platform", 489 }, 490 491 // Don't copy any output files to the dist. 492 no_dist: true, 493 494 lint: { 495 warning_checks: ["SuspiciousIndentation"], 496 }, 497} 498 499//========================================================== 500// build repackaged ICU tests 501// 502// Target builds against core-libart and core-oj so that it can access all the 503// repackaged android.icu classes and methods and not just the ones available 504// through the Android API. 505//========================================================== 506java_defaults { 507 name: "android-icu4j-tests-default", 508 visibility: [ 509 "//cts/tests/tests/icu", 510 ], 511 java_resource_dirs: [ 512 "src/main/tests", 513 "testing/src", 514 ], 515 libs: [ 516 "core-icu4j", 517 ], 518 static_libs: [ 519 "gson", 520 "junit", 521 "junit-params", 522 "tzdata-testing", 523 ], 524 525 patch_module: "java.base", 526 sdk_version: "none", 527 system_modules: "art-module-intra-core-api-stubs-system-modules", 528 529 errorprone: { 530 javacflags: [ 531 "-Xep:EqualsNull:WARN", 532 "-Xep:ArrayToString:WARN", 533 "-Xep:SelfEquals:WARN", 534 "-Xep:SelfComparison:WARN", 535 "-Xep:ReturnValueIgnored:WARN", 536 "-Xep:IdentityBinaryExpression:WARN", 537 "-Xep:BoxedPrimitiveEquality:WARN", 538 "-Xep:ComparableType:WARN", 539 ], 540 }, 541} 542 543java_test { 544 name: "android-icu4j-tests", 545 defaults: ["android-icu4j-tests-default"], 546 visibility: [ 547 "//cts/tests/tests/icu", 548 ], 549 srcs: [ 550 "src/main/tests/**/*.java", 551 "testing/src/**/*.java", 552 ], 553 libs: [ 554 "icu_aconfig_flags_lib", 555 "telephony-common", 556 "telephony_flags_core_java_lib", 557 ], 558 static_libs: [ 559 "flag-junit", 560 "junit", 561 "platform-parametric-runner-lib", 562 "platform-test-annotations", 563 ], 564} 565 566// Equivalent to android-icu4j-tests, excluding the tests under testing/. 567// We run this as ICU CTS on Ravenwood, where the testing/ tests won't pass due to lack of 568// libcore. 569java_test { 570 name: "android-icu4j-tests-core-only", 571 defaults: ["android-icu4j-tests-default"], 572 visibility: [ 573 "//cts/tests/tests/icu", 574 ], 575 srcs: [ 576 "src/main/tests/**/*.java", 577 "testing/src/android/icu/testsharding/**/*.java", 578 ], 579 // TODO(b/340889954) Un-excluide the excluded tests. 580 exclude_srcs: [ 581 // This class has a "known-failure", which we can't exclude on Ravenwood without 582 // modifying this file, so let's just exclude the whole class for now. 583 "src/main/tests/android/icu/dev/test/format/NumberFormatRegressionTest.java", 584 585 // This test takes too much time and hits the timeout. 586 "src/main/tests/android/icu/dev/test/rbbi/RBBIMonkeyTest.java", 587 ], 588} 589