blob: cdca9e2637d9cf693aab028ad6c60365079cbb48 [file] [log] [blame]
//
// Copyright (C) 2014 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_team: "trendy_team_java_core_libraries",
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"],
}
java_defaults {
name: "icu4j-defaults",
host_supported: true,
hostdex: true,
// Use the same Java language version in the Android build configuration as used
// in main/shared/build/common.properties for the ICU4J build configuration.
java_version: "1.8",
lint: {
warning_checks: ["SuspiciousIndentation"],
},
errorprone: {
javacflags: [
"-Xep:EmptyTopLevelDeclaration:WARN",
"-Xep:BoxedPrimitiveEquality:WARN",
"-Xep:EqualsHashCode:WARN",
"-Xep:ComparableType:WARN",
"-Xep:SelfAssignment:WARN",
"-Xep:ReturnValueIgnored:WARN",
"-Xep:SelfComparison:WARN",
"-Xep:SelfEquals:WARN",
"-Xep:MisusedDayOfYear:WARN",
"-Xep:MisusedWeekYear:WARN",
"-Xep:IdentityBinaryExpression:WARN",
],
},
sdk_version: "current",
}
java_library {
name: "icu4j",
visibility: [
"//bootable/recovery/tools/image_generator",
"//external/icu/tools/srcgen",
"//external/jimfs/jimfs",
"//external/robolectric-shadows/robolectric",
"//external/robolectric-shadows/shadows/framework",
"//external/robolectric/robolectric",
"//external/robolectric/shadows/framework",
"//frameworks/base/ravenwood:__subpackages__",
"//system/timezone/input_tools/android/telephonylookup_generator",
"//system/timezone/input_tools/android/tzlookup_generator",
],
defaults: ["icu4j-defaults"],
libs: [
// Need the following shared libraries for @FlaggedApi. These libraries are only needed
// compile-time, not runtime, and it shouldn't need to be statically linked.
// framework-api-annotations are not static libs to avoid exposing the definition of
// framework's annotations from ICU (wrong place) instead of framework (correct place).
"framework-annotations-lib",
"icu_aconfig_flags_lib",
],
srcs: ["main/*/src/main/java/**/*.java"],
java_resource_dirs: ["main/*/src/main/resources"],
// User-supplied locale service providers (using the java.text.spi or
// java.util.spi mechanisms) are not supported in Android:
//
// http://developer.android.com/reference/java/util/Locale.html
exclude_srcs: ["main/localespi/src/main/java/**/*.java"],
exclude_java_resource_dirs: [
"main/localespi/src/main/resources",
// The actual resource files are included by linking icu4j-icudata and icu4j-icutzdata
// statically.
"main/*/src/main/resources/com/ibm/icu/impl/data/icudt*",
],
static_libs: [
"icu4j-icudata",
"icu4j-icutzdata",
],
}
java_test {
name: "icu4j-tests",
defaults: ["icu4j-defaults"],
srcs: [
"main/*/src/test/**/*.java",
],
java_resource_dirs: ["main/*/src/test/resources"],
exclude_srcs: ["main/localespi/src/test/**/*.java"],
exclude_java_resource_dirs: ["main/localespi/src/test"],
static_libs: [
"gson",
"icu4j",
"icu4j-testdata",
"junit-params",
],
errorprone: {
javacflags: [
"-Xep:EqualsNull:WARN",
"-Xep:ArrayToString:WARN",
],
},
test_options: {
unit_test: false,
},
}
java_import {
name: "icu4j-icudata",
host_supported: true,
jars: ["main/shared/data/icudata.jar"],
}
java_import {
name: "icu4j-icutzdata",
host_supported: true,
jars: ["main/shared/data/icutzdata.jar"],
}
java_import {
name: "icu4j-testdata",
host_supported: true,
jars: ["main/shared/data/testdata.jar"],
}
// LayoutLib (frameworks/layoutlib), ravewnwood and robolectric need
// JarJar'd versions of the icudata and icutzdata, so add rules for it.
java_library {
name: "icu4j-icudata-jarjar",
visibility: [
"//external/robolectric-shadows",
"//external/robolectric",
"//frameworks/base/ravenwood:__subpackages__",
"//frameworks/layoutlib",
],
defaults: ["icu4j-defaults"],
static_libs: ["icu4j-icudata"],
jarjar_rules: "liblayout-jarjar-rules.txt",
}
java_library {
name: "icu4j-icutzdata-jarjar",
visibility: [
"//external/robolectric-shadows",
"//external/robolectric",
"//frameworks/base/ravenwood:__subpackages__",
"//frameworks/layoutlib",
],
defaults: ["icu4j-defaults"],
static_libs: ["icu4j-icutzdata"],
jarjar_rules: "liblayout-jarjar-rules.txt",
}
// Compatibility alias until references to icu4j-host are removed
//
// When converting .mk files to .bp files do not change the visibility of this
// module, instead replace usages of this with icu4j
java_library_host {
name: "icu4j-host",
static_libs: ["icu4j"],
}