blob: ddeec1185d9d956257b51b5e48968ceb291fe31c [file] [log] [blame]
Colin Cross6e18e292018-09-11 16:41:13 -07001//
2// Copyright (C) 2014 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
Paul Duffind772e592019-06-03 16:09:02 +010017package {
18 default_visibility: ["//visibility:private"],
19}
20
Colin Cross6e18e292018-09-11 16:41:13 -070021java_defaults {
22 name: "icu4j-defaults",
23 host_supported: true,
24 hostdex: true,
25
26 // Use the same Java language version in the Android build configuration as used
27 // in main/shared/build/common.properties for the ICU4J build configuration.
Victor Changfdd2c3a2018-09-17 10:57:01 +010028 java_version: "1.7",
Colin Cross6e18e292018-09-11 16:41:13 -070029}
30
31java_library {
32 name: "icu4j",
Paul Duffind772e592019-06-03 16:09:02 +010033 visibility: [
34 "//bootable/recovery/tools/image_generator",
35 "//external/icu/tools/srcgen",
Hadrien Zalek1480ce42020-07-13 12:13:05 -070036 "//external/jimfs/jimfs",
Paul Duffind772e592019-06-03 16:09:02 +010037 "//external/robolectric-shadows/robolectric",
38 "//external/robolectric-shadows/shadows/framework",
Neil Fullerc2367342019-10-28 18:46:33 +000039 "//system/timezone/input_tools/android/telephonylookup_generator",
Neil Fuller0a06ffe2019-10-28 11:27:17 +000040 "//system/timezone/input_tools/android/tzlookup_generator",
Paul Duffind772e592019-06-03 16:09:02 +010041 ],
Colin Cross6e18e292018-09-11 16:41:13 -070042 defaults: ["icu4j-defaults"],
43
44 srcs: ["main/classes/**/*.java"],
45 java_resource_dirs: ["main/classes/*/src"],
46
47 // User-supplied locale service providers (using the java.text.spi or
48 // java.util.spi mechanisms) are not supported in Android:
49 //
50 // http://developer.android.com/reference/java/util/Locale.html
51 exclude_srcs: ["main/classes/localespi/**/*.java"],
52 exclude_java_resource_dirs: ["main/classes/localespi/src"],
53
Victor Chang58cfed02018-11-14 16:44:33 +000054 static_libs: [
55 "icu4j-icudata",
56 "icu4j-icutzdata",
57 ],
Colin Cross6e18e292018-09-11 16:41:13 -070058}
59
Victor Chang53ddc8d2020-07-28 11:44:46 +010060// Small static library used by TwilightService in the system server. To avoid @CorePlaformApi,
61// the system server doesn't use CalendarAstronomer in android.icu.
62// Don't link this in boot classpath or Zygote to avoid class collision with the
63// com.ibm.icu.impl.CalendarAstronomer in the app classloader.
64java_library_static {
65 name: "icu4j_calendar_astronomer",
66 host_supported: false,
67 srcs: ["main/classes/core/src/com/ibm/icu/impl/CalendarAstronomer.java"],
68 visibility: ["//frameworks/base/services/core"],
69}
70
Colin Cross6e18e292018-09-11 16:41:13 -070071java_test {
72 name: "icu4j-tests",
73 defaults: ["icu4j-defaults"],
74
Nikita Iashchenkoc975c362019-12-19 18:00:32 +000075 srcs: [
76 "main/tests/**/*.java",
77 "tools/misc/src/com/ibm/icu/dev/tool/locale/*.java",
78 ],
Colin Cross6e18e292018-09-11 16:41:13 -070079 java_resource_dirs: ["main/tests/*/src"],
80
81 exclude_srcs: ["main/tests/localespi/**/*.java"],
82 exclude_java_resource_dirs: ["main/tests/localespi/src"],
83
84 static_libs: [
85 "icu4j",
86 "icu4j-testdata",
87 "junit-params",
88 ],
89}
90
91java_import {
92 name: "icu4j-icudata",
93 host_supported: true,
94 jars: ["main/shared/data/icudata.jar"],
95}
96
97java_import {
98 name: "icu4j-icutzdata",
99 host_supported: true,
100 jars: ["main/shared/data/icutzdata.jar"],
101}
102
103java_import {
104 name: "icu4j-testdata",
105 host_supported: true,
106 jars: ["main/shared/data/testdata.jar"],
107}
108
Paul Duffind772e592019-06-03 16:09:02 +0100109// LayoutLib (frameworks/layoutlib) and robolectric need JarJar'd versions of
110// the icudata and icutzdata, so add rules for it.
111java_library {
Colin Cross6e18e292018-09-11 16:41:13 -0700112 name: "icu4j-icudata-jarjar",
Paul Duffind772e592019-06-03 16:09:02 +0100113 visibility: [
114 "//external/robolectric-shadows",
115 "//frameworks/layoutlib",
116 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700117 defaults: ["icu4j-defaults"],
118 static_libs: ["icu4j-icudata"],
119 jarjar_rules: "liblayout-jarjar-rules.txt",
120}
121
Paul Duffind772e592019-06-03 16:09:02 +0100122java_library {
Colin Cross6e18e292018-09-11 16:41:13 -0700123 name: "icu4j-icutzdata-jarjar",
Paul Duffind772e592019-06-03 16:09:02 +0100124 visibility: [
125 "//external/robolectric-shadows",
126 "//frameworks/layoutlib",
127 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700128 defaults: ["icu4j-defaults"],
129 static_libs: ["icu4j-icutzdata"],
130 jarjar_rules: "liblayout-jarjar-rules.txt",
131}
132
133// Compatibility alias until references to icu4j-host are removed
Paul Duffind772e592019-06-03 16:09:02 +0100134//
135// When converting .mk files to .bp files do not change the visibility of this
136// module, instead replace usages of this with icu4j
Colin Cross6e18e292018-09-11 16:41:13 -0700137java_library_host {
138 name: "icu4j-host",
139 static_libs: ["icu4j"],
140}
Victor Change9935982018-09-21 14:55:40 +0100141
142// Rules to generate android_icu4j files during build time
143// The following rules are used in the downstream branches master-icu-dev only,
144// but NOT used in AOSP.
145generate_script_srcs = [
146 "main/**/*",
147 "samples/**/*",
148]
149generate_script_tools = [
150 "android_icu4j_srcgen_binary",
151 "soong_zip",
152]
153generate_script_tool_files = [
154 ":generate_android_icu4j_script",
155]
156// ANDROID_BUILD_TOP is needed to be set for generate_android_icu4j.sh
157generate_script_common_cmd = "export ANDROID_BUILD_TOP=$$(pwd) && " +
Colin Crossd4025ce2018-10-05 12:35:15 -0700158 "$(location :generate_android_icu4j_script) " +
Victor Change9935982018-09-21 14:55:40 +0100159 "--no-doc-patch " +
160 "--gen $(genDir) " +
161 "--srcgen-tool $(location android_icu4j_srcgen_binary)"
162
163genrule {
164 name: "generated_android_icu4j_src_files",
Victor Changc25296f2019-03-22 22:48:10 +0000165 enabled: false, // http://b/117312606
Victor Change9935982018-09-21 14:55:40 +0100166 srcs: generate_script_srcs,
167 tools: generate_script_tools,
168 tool_files: generate_script_tool_files,
169 out: ["generated_android_icu4j.srcjar"],
170 cmd: generate_script_common_cmd +
171 "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/java " +
172 "-D $(genDir)/android_icu4j/src/main/java",
173}
174
175java_genrule {
176 name: "generated_android_icu4j_resources",
Victor Changc25296f2019-03-22 22:48:10 +0000177 enabled: false, // http://b/117312606
Victor Change9935982018-09-21 14:55:40 +0100178 host_supported: true,
179 srcs: generate_script_srcs,
180 tools: generate_script_tools,
181 tool_files: generate_script_tool_files,
182 out: ["generated_android_icu4j_resources.jar"],
183 cmd: generate_script_common_cmd +
184 "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/resources " +
185 "-D $(genDir)/android_icu4j/resources",
186}
187
188genrule {
189 name: "generated_android_icu4j_test_files",
Victor Changc25296f2019-03-22 22:48:10 +0000190 enabled: false, // http://b/117312606
Victor Change9935982018-09-21 14:55:40 +0100191 srcs: generate_script_srcs,
192 tools: generate_script_tools,
193 tool_files: generate_script_tool_files,
194 out: ["generated_android_icu4j_test.srcjar"],
195 cmd: generate_script_common_cmd +
196 "&& find $(genDir)/android_icu4j/src/main/tests -type f -not -name \"*.java\" -exec rm {} \\; " +
197 "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/tests " +
198 "-D $(genDir)/android_icu4j/src/main/tests",
199}
200
201java_genrule {
202 name: "generated_android_icu4j_test_resources",
Victor Changc25296f2019-03-22 22:48:10 +0000203 enabled: false, // http://b/117312606
Victor Change9935982018-09-21 14:55:40 +0100204 host_supported: true,
205 srcs: generate_script_srcs,
206 tools: generate_script_tools,
207 tool_files: generate_script_tool_files,
208 out: ["generated_android_icu4j_test_resources.jar"],
209 cmd: generate_script_common_cmd +
210 "&& find $(genDir)/android_icu4j/src/main/tests -type f -name \"*.java\" -exec rm {} \\; " +
211 "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/tests " +
212 "-D $(genDir)/android_icu4j/src/main/tests",
213}