// // Copyright (C) 2017 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package { default_visibility: ["//visibility:private"], // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "external_icu_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 // SPDX-license-identifier-BSD // SPDX-license-identifier-ICU // SPDX-license-identifier-MIT // SPDX-license-identifier-Unicode-DFS // legacy_unencumbered default_applicable_licenses: ["external_icu_license"], } //========================================================== // build repackaged ICU for target // // This is done in the libcore/JavaLibraries.mk file as there are circular // dependencies between ICU and libcore //========================================================== filegroup { name: "android_icu4j_public_api_files", srcs: [ ":android_icu4j_repackaged_src_files", ], path: "src/main/java", } filegroup { name: "android_icu4j_repackaged_src_files", srcs: ["src/main/java/android/icu/**/*.java"], path: "src/main/java", } // The files contains Android-specific codes to expose intra-core APIs // from ICU4J/ICU4C to libcore or core platform APIs to the framework. // The package is com.android.icu.* and should not expose any public APIs. filegroup { name: "libcore_icu_bridge_src_files", srcs: ["libcore_bridge/src/java/**/*.java"], path: "libcore_bridge/src/java", } java_defaults { name: "libcore_icu_bridge_defaults", srcs: [ "libcore_bridge/src/java/**/*.java", ":app-compat-annotations-source", ], jarjar_rules: "jarjar-rules.txt", plugins: [ "compat-changeid-annotation-processor", ], } // A host library containing time zone related classes. Used for // host-side tools and tests that have to deal with Android // time zone data. java_library_host { name: "timezone-host", visibility: [ "//packages/modules/RuntimeI18n/apex", "//system/timezone/distro/core", ], srcs: [ "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java", ], libs: [ "art.module.api.annotations", ], } // core-repackaged-icu4j contains only the repackaged ICU4J that does not // use any internal or android specific code. If it ever did then it could depend on // art-module-intra-core-api-stubs-system-modules (a superset) instead. // It is important that core-icu4j is restricted to only use stable APIs from the ART module // since it is in a different APEX module that can be updated independently. java_library_static { name: "core-repackaged-icu4j", installable: false, srcs: [":android_icu4j_repackaged_src_files"], libs: ["unsupportedappusage"], // The resource files are generated in the downstream branch master-icu-dev. java_resource_dirs: ["resources"], sdk_version: "none", system_modules: "art-module-public-api-stubs-system-modules", dxflags: ["--core-library"], apex_available: [ "com.android.i18n", ], errorprone: { javacflags: [ "-Xep:MissingOverride:OFF", // Ignore missing @Override. "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom ], }, } // A separated core library that contains ICU4J because ICU4J will be in a different APEX module, // not in ART module. java_library { name: "core-icu4j", defaults: ["libcore_icu_bridge_defaults"], visibility: [ "//packages/modules/RuntimeI18n/apex", ], apex_available: [ "com.android.i18n", ], permitted_packages: [ "android.icu", "com.android.icu", "com.android.i18n.timezone", ], installable: true, hostdex: false, static_libs: ["core-repackaged-icu4j"], // It is important that core-icu4j is restricted to only use stable APIs from the ART module // since it is in a different APEX module that can be updated independently. sdk_version: "none", system_modules: "art-module-intra-core-api-stubs-system-modules", dxflags: ["--core-library"], } // Java library for use on host, e.g. by robolectric. java_library { name: "core-icu4j-for-host", visibility: [ "//art/build", "//external/robolectric-shadows", "//frameworks/layoutlib", "//packages/modules/RuntimeI18n/apex", ], static_libs: [ "core-icu4j", ], sdk_version: "none", system_modules: "none", } platform_compat_config { name: "icu4j-platform-compat-config", src: ":core-icu4j", } java_sdk_library { name: "i18n.module.public.api", visibility: [ "//frameworks/base", "//frameworks/base/api", "//libcore", "//packages/modules/RuntimeI18n/apex", // Visibility for prebuilt i18n-module-sdk from the prebuilt of // this module. // TODO(b/155921753): Restrict this when prebuilts are in their proper // locations. "//prebuilts:__subpackages__", ], srcs: [ ":android_icu4j_public_api_files", ], droiddoc_options: [ "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ", ], errorprone: { javacflags: [ "-Xep:MissingOverride:OFF", ], }, api_dir: "api/public", api_only: true, sdk_version: "none", system_modules: "art-module-public-api-stubs-system-modules", // The base name for the artifacts that are automatically published to the // dist and which end up in one of the sub-directories of prebuilts/sdk. // As long as this matches the name of the artifacts in prebuilts/sdk then // the API will be checked for compatibility against the latest released // version of the API. dist_stem: "runtime-i18n", dist_group: "android", } // Generates stub source files for the intra-core API of the I18N module. // i.e. every class/member that is either in the public API or annotated with // @IntraCoreApi. // // The API specification .txt files managed by this only contain the additional // classes/members that are in the intra-core API but which are not the public // API. java_sdk_library { name: "i18n.module.intra.core.api", defaults: ["libcore_icu_bridge_defaults"], srcs: [ ":android_icu4j_repackaged_src_files", ], visibility: [ "//libcore:__subpackages__", "//packages/modules/RuntimeI18n/apex", // Visibility for prebuilt i18n-module-sdk from the prebuilt of // this module. // TODO(b/155921753): Restrict this when prebuilts are in their proper // locations. "//prebuilts:__subpackages__", ], api_dir: "api/intra", api_only: true, sdk_version: "none", system_modules: "art-module-intra-core-api-stubs-system-modules", droiddoc_options: [ "--hide-annotation libcore.api.Hide ", "--show-single-annotation libcore.api.IntraCoreApi ", "--skip-annotation-instance-methods=false ", ], // Don't copy any output files to the dist. no_dist: true, } // Referenced implicitly from i18n.module.intra.core.api. filegroup { name: "i18n.module.intra.core.api.api.public.latest", srcs: [ "api/intra/last-api.txt", ], } // Referenced implicitly from i18n.module.intra.core.api. filegroup { name: "i18n.module.intra.core.api-removed.api.public.latest", srcs: [ "api/intra/last-removed.txt", ], } // Referenced implicitly from i18n.module.intra.core.api. filegroup { name: "i18n.module.intra.core.api-incompatibilities.api.public.latest", srcs: [ "api/intra/last-incompatibilities.txt", ], } // Referenced implicitly from legacy.i18n.module.platform.api. filegroup { name: "legacy.i18n.module.platform.api.api.public.latest", srcs: [ "api/legacy_platform/last-api.txt", ], } // Referenced implicitly from legacy.i18n.module.platform.api. filegroup { name: "legacy.i18n.module.platform.api-removed.api.public.latest", srcs: [ "api/legacy_platform/last-removed.txt", ], } // Referenced implicitly from legacy.i18n.module.platform.api. filegroup { name: "legacy.i18n.module.platform.api-incompatibilities.api.public.latest", srcs: [ "api/legacy_platform/last-incompatibilities.txt", ], } // Referenced implicitly from stable.i18n.module.platform.api. filegroup { name: "stable.i18n.module.platform.api.api.public.latest", srcs: [ "api/stable_platform/last-api.txt", ], } // Referenced implicitly from stable.i18n.module.platform.api. filegroup { name: "stable.i18n.module.platform.api-removed.api.public.latest", srcs: [ "api/stable_platform/last-removed.txt", ], } // Referenced implicitly from stable.i18n.module.platform.api. filegroup { name: "stable.i18n.module.platform.api-incompatibilities.api.public.latest", srcs: [ "api/stable_platform/last-incompatibilities.txt", ], } // Generates stub source files for the core platform API of the I18N module. // i.e. every class/member that is either in the public API or annotated with // @CorePlatformApi. // // The API specification .txt files managed by this only contain the additional // classes/members that are in the intra-core API but which are not in the public // API. // // For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp. java_sdk_library { name: "legacy.i18n.module.platform.api", defaults: ["libcore_icu_bridge_defaults"], srcs: [ ":android_icu4j_repackaged_src_files", ], visibility: [ "//libcore:__subpackages__", "//packages/modules/RuntimeI18n/apex", // Visibility for prebuilt i18n-module-sdk from the prebuilt of // this module. // TODO(b/155921753): Restrict this when prebuilts are in their proper // locations. "//prebuilts:__subpackages__", ], hostdex: true, api_dir: "api/legacy_platform", api_only: true, sdk_version: "none", system_modules: "art-module-lib-api-stubs-system-modules", droiddoc_options: [ "--hide-annotation libcore.api.Hide ", "--show-single-annotation libcore.api.CorePlatformApi ", "--skip-annotation-instance-methods=false ", ], // Don't copy any output files to the dist. no_dist: true, } java_sdk_library { name: "stable.i18n.module.platform.api", defaults: ["libcore_icu_bridge_defaults"], srcs: [ ":android_icu4j_repackaged_src_files", ], visibility: [ "//libcore:__subpackages__", "//packages/modules/RuntimeI18n/apex", // Visibility for prebuilt i18n-module-sdk from the prebuilt of // this module. // TODO(b/155921753): Restrict this when prebuilts are in their proper // locations. "//prebuilts:__subpackages__", ], hostdex: true, api_dir: "api/stable_platform", api_only: true, sdk_version: "none", system_modules: "art-module-lib-api-stubs-system-modules", droiddoc_options: [ "--hide-annotation libcore.api.Hide ", "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)", "--skip-annotation-instance-methods=false ", ], // Don't copy any output files to the dist. no_dist: true, } //========================================================== // build repackaged ICU tests // // Target builds against core-libart and core-oj so that it can access all the // repackaged android.icu classes and methods and not just the ones available // through the Android API. //========================================================== java_test { name: "android-icu4j-tests", visibility: [ "//cts/tests/tests/icu", ], srcs: [ "src/main/tests/**/*.java", "testing/src/**/*.java", ], java_resource_dirs: [ "src/main/tests", "testing/src", ], libs: [ "core-icu4j", ], static_libs: [ "junit", "junit-params", "tzdata-testing", ], patch_module: "java.base", sdk_version: "none", system_modules: "art-module-intra-core-api-stubs-system-modules", }