xref: /aosp_15_r20/external/icu/icu4j/Android.bp (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker//
2*0e209d39SAndroid Build Coastguard Worker// Copyright (C) 2014 The Android Open Source Project
3*0e209d39SAndroid Build Coastguard Worker//
4*0e209d39SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*0e209d39SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*0e209d39SAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*0e209d39SAndroid Build Coastguard Worker//
8*0e209d39SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*0e209d39SAndroid Build Coastguard Worker//
10*0e209d39SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*0e209d39SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*0e209d39SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*0e209d39SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*0e209d39SAndroid Build Coastguard Worker// limitations under the License.
15*0e209d39SAndroid Build Coastguard Worker//
16*0e209d39SAndroid Build Coastguard Worker
17*0e209d39SAndroid Build Coastguard Workerpackage {
18*0e209d39SAndroid Build Coastguard Worker    default_team: "trendy_team_java_core_libraries",
19*0e209d39SAndroid Build Coastguard Worker    default_visibility: ["//visibility:private"],
20*0e209d39SAndroid Build Coastguard Worker    // See: http://go/android-license-faq
21*0e209d39SAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
22*0e209d39SAndroid Build Coastguard Worker    // all of the 'license_kinds' from "external_icu_license"
23*0e209d39SAndroid Build Coastguard Worker    // to get the below license kinds:
24*0e209d39SAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
25*0e209d39SAndroid Build Coastguard Worker    //   SPDX-license-identifier-BSD
26*0e209d39SAndroid Build Coastguard Worker    //   SPDX-license-identifier-ICU
27*0e209d39SAndroid Build Coastguard Worker    //   SPDX-license-identifier-MIT
28*0e209d39SAndroid Build Coastguard Worker    //   SPDX-license-identifier-Unicode-DFS
29*0e209d39SAndroid Build Coastguard Worker    //   legacy_unencumbered
30*0e209d39SAndroid Build Coastguard Worker    default_applicable_licenses: ["external_icu_license"],
31*0e209d39SAndroid Build Coastguard Worker}
32*0e209d39SAndroid Build Coastguard Worker
33*0e209d39SAndroid Build Coastguard Workerjava_defaults {
34*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-defaults",
35*0e209d39SAndroid Build Coastguard Worker    host_supported: true,
36*0e209d39SAndroid Build Coastguard Worker    hostdex: true,
37*0e209d39SAndroid Build Coastguard Worker
38*0e209d39SAndroid Build Coastguard Worker    // Use the same Java language version in the Android build configuration as used
39*0e209d39SAndroid Build Coastguard Worker    // in main/shared/build/common.properties for the ICU4J build configuration.
40*0e209d39SAndroid Build Coastguard Worker    java_version: "1.8",
41*0e209d39SAndroid Build Coastguard Worker    lint: {
42*0e209d39SAndroid Build Coastguard Worker        warning_checks: ["SuspiciousIndentation"],
43*0e209d39SAndroid Build Coastguard Worker    },
44*0e209d39SAndroid Build Coastguard Worker    errorprone: {
45*0e209d39SAndroid Build Coastguard Worker        javacflags: [
46*0e209d39SAndroid Build Coastguard Worker            "-Xep:EmptyTopLevelDeclaration:WARN",
47*0e209d39SAndroid Build Coastguard Worker            "-Xep:BoxedPrimitiveEquality:WARN",
48*0e209d39SAndroid Build Coastguard Worker            "-Xep:EqualsHashCode:WARN",
49*0e209d39SAndroid Build Coastguard Worker            "-Xep:ComparableType:WARN",
50*0e209d39SAndroid Build Coastguard Worker            "-Xep:SelfAssignment:WARN",
51*0e209d39SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
52*0e209d39SAndroid Build Coastguard Worker            "-Xep:SelfComparison:WARN",
53*0e209d39SAndroid Build Coastguard Worker            "-Xep:SelfEquals:WARN",
54*0e209d39SAndroid Build Coastguard Worker            "-Xep:MisusedDayOfYear:WARN",
55*0e209d39SAndroid Build Coastguard Worker            "-Xep:MisusedWeekYear:WARN",
56*0e209d39SAndroid Build Coastguard Worker            "-Xep:IdentityBinaryExpression:WARN",
57*0e209d39SAndroid Build Coastguard Worker        ],
58*0e209d39SAndroid Build Coastguard Worker    },
59*0e209d39SAndroid Build Coastguard Worker    sdk_version: "current",
60*0e209d39SAndroid Build Coastguard Worker}
61*0e209d39SAndroid Build Coastguard Worker
62*0e209d39SAndroid Build Coastguard Workerjava_library {
63*0e209d39SAndroid Build Coastguard Worker    name: "icu4j",
64*0e209d39SAndroid Build Coastguard Worker    visibility: [
65*0e209d39SAndroid Build Coastguard Worker        "//bootable/recovery/tools/image_generator",
66*0e209d39SAndroid Build Coastguard Worker        "//external/icu/tools/srcgen",
67*0e209d39SAndroid Build Coastguard Worker        "//external/jimfs/jimfs",
68*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric-shadows/robolectric",
69*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric-shadows/shadows/framework",
70*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric/robolectric",
71*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric/shadows/framework",
72*0e209d39SAndroid Build Coastguard Worker        "//frameworks/base/ravenwood:__subpackages__",
73*0e209d39SAndroid Build Coastguard Worker        "//system/timezone/input_tools/android/telephonylookup_generator",
74*0e209d39SAndroid Build Coastguard Worker        "//system/timezone/input_tools/android/tzlookup_generator",
75*0e209d39SAndroid Build Coastguard Worker    ],
76*0e209d39SAndroid Build Coastguard Worker    defaults: ["icu4j-defaults"],
77*0e209d39SAndroid Build Coastguard Worker    libs: [
78*0e209d39SAndroid Build Coastguard Worker        // Need the following shared libraries for @FlaggedApi. These libraries are only needed
79*0e209d39SAndroid Build Coastguard Worker        // compile-time, not runtime, and it shouldn't need to be statically linked.
80*0e209d39SAndroid Build Coastguard Worker        // framework-api-annotations are not static libs to avoid exposing the definition of
81*0e209d39SAndroid Build Coastguard Worker        // framework's annotations from ICU (wrong place) instead of framework (correct place).
82*0e209d39SAndroid Build Coastguard Worker        "framework-annotations-lib",
83*0e209d39SAndroid Build Coastguard Worker        "icu_aconfig_flags_lib",
84*0e209d39SAndroid Build Coastguard Worker    ],
85*0e209d39SAndroid Build Coastguard Worker
86*0e209d39SAndroid Build Coastguard Worker    srcs: ["main/*/src/main/java/**/*.java"],
87*0e209d39SAndroid Build Coastguard Worker    java_resource_dirs: ["main/*/src/main/resources"],
88*0e209d39SAndroid Build Coastguard Worker
89*0e209d39SAndroid Build Coastguard Worker    // User-supplied locale service providers (using the java.text.spi or
90*0e209d39SAndroid Build Coastguard Worker    // java.util.spi mechanisms) are not supported in Android:
91*0e209d39SAndroid Build Coastguard Worker    //
92*0e209d39SAndroid Build Coastguard Worker    // http://developer.android.com/reference/java/util/Locale.html
93*0e209d39SAndroid Build Coastguard Worker    exclude_srcs: ["main/localespi/src/main/java/**/*.java"],
94*0e209d39SAndroid Build Coastguard Worker    exclude_java_resource_dirs: [
95*0e209d39SAndroid Build Coastguard Worker        "main/localespi/src/main/resources",
96*0e209d39SAndroid Build Coastguard Worker        // The actual resource files are included by linking icu4j-icudata and icu4j-icutzdata
97*0e209d39SAndroid Build Coastguard Worker        // statically.
98*0e209d39SAndroid Build Coastguard Worker        "main/*/src/main/resources/com/ibm/icu/impl/data/icudt*",
99*0e209d39SAndroid Build Coastguard Worker    ],
100*0e209d39SAndroid Build Coastguard Worker
101*0e209d39SAndroid Build Coastguard Worker    static_libs: [
102*0e209d39SAndroid Build Coastguard Worker        "icu4j-icudata",
103*0e209d39SAndroid Build Coastguard Worker        "icu4j-icutzdata",
104*0e209d39SAndroid Build Coastguard Worker    ],
105*0e209d39SAndroid Build Coastguard Worker}
106*0e209d39SAndroid Build Coastguard Worker
107*0e209d39SAndroid Build Coastguard Workerjava_test {
108*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-tests",
109*0e209d39SAndroid Build Coastguard Worker    defaults: ["icu4j-defaults"],
110*0e209d39SAndroid Build Coastguard Worker
111*0e209d39SAndroid Build Coastguard Worker    srcs: [
112*0e209d39SAndroid Build Coastguard Worker        "main/*/src/test/**/*.java",
113*0e209d39SAndroid Build Coastguard Worker    ],
114*0e209d39SAndroid Build Coastguard Worker    java_resource_dirs: ["main/*/src/test/resources"],
115*0e209d39SAndroid Build Coastguard Worker
116*0e209d39SAndroid Build Coastguard Worker    exclude_srcs: ["main/localespi/src/test/**/*.java"],
117*0e209d39SAndroid Build Coastguard Worker    exclude_java_resource_dirs: ["main/localespi/src/test"],
118*0e209d39SAndroid Build Coastguard Worker
119*0e209d39SAndroid Build Coastguard Worker    static_libs: [
120*0e209d39SAndroid Build Coastguard Worker        "gson",
121*0e209d39SAndroid Build Coastguard Worker        "icu4j",
122*0e209d39SAndroid Build Coastguard Worker        "icu4j-testdata",
123*0e209d39SAndroid Build Coastguard Worker        "junit-params",
124*0e209d39SAndroid Build Coastguard Worker    ],
125*0e209d39SAndroid Build Coastguard Worker
126*0e209d39SAndroid Build Coastguard Worker    errorprone: {
127*0e209d39SAndroid Build Coastguard Worker        javacflags: [
128*0e209d39SAndroid Build Coastguard Worker            "-Xep:EqualsNull:WARN",
129*0e209d39SAndroid Build Coastguard Worker            "-Xep:ArrayToString:WARN",
130*0e209d39SAndroid Build Coastguard Worker        ],
131*0e209d39SAndroid Build Coastguard Worker    },
132*0e209d39SAndroid Build Coastguard Worker
133*0e209d39SAndroid Build Coastguard Worker    test_options: {
134*0e209d39SAndroid Build Coastguard Worker        unit_test: false,
135*0e209d39SAndroid Build Coastguard Worker    },
136*0e209d39SAndroid Build Coastguard Worker}
137*0e209d39SAndroid Build Coastguard Worker
138*0e209d39SAndroid Build Coastguard Workerjava_import {
139*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-icudata",
140*0e209d39SAndroid Build Coastguard Worker    host_supported: true,
141*0e209d39SAndroid Build Coastguard Worker    jars: ["main/shared/data/icudata.jar"],
142*0e209d39SAndroid Build Coastguard Worker}
143*0e209d39SAndroid Build Coastguard Worker
144*0e209d39SAndroid Build Coastguard Workerjava_import {
145*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-icutzdata",
146*0e209d39SAndroid Build Coastguard Worker    host_supported: true,
147*0e209d39SAndroid Build Coastguard Worker    jars: ["main/shared/data/icutzdata.jar"],
148*0e209d39SAndroid Build Coastguard Worker}
149*0e209d39SAndroid Build Coastguard Worker
150*0e209d39SAndroid Build Coastguard Workerjava_import {
151*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-testdata",
152*0e209d39SAndroid Build Coastguard Worker    host_supported: true,
153*0e209d39SAndroid Build Coastguard Worker    jars: ["main/shared/data/testdata.jar"],
154*0e209d39SAndroid Build Coastguard Worker}
155*0e209d39SAndroid Build Coastguard Worker
156*0e209d39SAndroid Build Coastguard Worker// LayoutLib (frameworks/layoutlib), ravewnwood and robolectric need
157*0e209d39SAndroid Build Coastguard Worker// JarJar'd versions of the icudata and icutzdata, so add rules for it.
158*0e209d39SAndroid Build Coastguard Workerjava_library {
159*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-icudata-jarjar",
160*0e209d39SAndroid Build Coastguard Worker    visibility: [
161*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric-shadows",
162*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric",
163*0e209d39SAndroid Build Coastguard Worker        "//frameworks/base/ravenwood:__subpackages__",
164*0e209d39SAndroid Build Coastguard Worker        "//frameworks/layoutlib",
165*0e209d39SAndroid Build Coastguard Worker    ],
166*0e209d39SAndroid Build Coastguard Worker    defaults: ["icu4j-defaults"],
167*0e209d39SAndroid Build Coastguard Worker    static_libs: ["icu4j-icudata"],
168*0e209d39SAndroid Build Coastguard Worker    jarjar_rules: "liblayout-jarjar-rules.txt",
169*0e209d39SAndroid Build Coastguard Worker}
170*0e209d39SAndroid Build Coastguard Worker
171*0e209d39SAndroid Build Coastguard Workerjava_library {
172*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-icutzdata-jarjar",
173*0e209d39SAndroid Build Coastguard Worker    visibility: [
174*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric-shadows",
175*0e209d39SAndroid Build Coastguard Worker        "//external/robolectric",
176*0e209d39SAndroid Build Coastguard Worker        "//frameworks/base/ravenwood:__subpackages__",
177*0e209d39SAndroid Build Coastguard Worker        "//frameworks/layoutlib",
178*0e209d39SAndroid Build Coastguard Worker    ],
179*0e209d39SAndroid Build Coastguard Worker    defaults: ["icu4j-defaults"],
180*0e209d39SAndroid Build Coastguard Worker    static_libs: ["icu4j-icutzdata"],
181*0e209d39SAndroid Build Coastguard Worker    jarjar_rules: "liblayout-jarjar-rules.txt",
182*0e209d39SAndroid Build Coastguard Worker}
183*0e209d39SAndroid Build Coastguard Worker
184*0e209d39SAndroid Build Coastguard Workerjava_library_host {
185*0e209d39SAndroid Build Coastguard Worker    name: "icu4j-host",
186*0e209d39SAndroid Build Coastguard Worker    static_libs: ["icu4j"],
187*0e209d39SAndroid Build Coastguard Worker    visibility: [
188*0e209d39SAndroid Build Coastguard Worker        "//vendor:__subpackages__",
189*0e209d39SAndroid Build Coastguard Worker    ],
190*0e209d39SAndroid Build Coastguard Worker}
191