Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 1 | // |
| 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 Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 17 | package { |
| 18 | default_visibility: ["//visibility:private"], |
| 19 | } |
| 20 | |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 21 | java_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 Chang | fdd2c3a | 2018-09-17 10:57:01 +0100 | [diff] [blame] | 28 | java_version: "1.7", |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | java_library { |
| 32 | name: "icu4j", |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 33 | visibility: [ |
| 34 | "//bootable/recovery/tools/image_generator", |
| 35 | "//external/icu/tools/srcgen", |
Hadrien Zalek | 1480ce4 | 2020-07-13 12:13:05 -0700 | [diff] [blame] | 36 | "//external/jimfs/jimfs", |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 37 | "//external/robolectric-shadows/robolectric", |
| 38 | "//external/robolectric-shadows/shadows/framework", |
Neil Fuller | c236734 | 2019-10-28 18:46:33 +0000 | [diff] [blame] | 39 | "//system/timezone/input_tools/android/telephonylookup_generator", |
Neil Fuller | 0a06ffe | 2019-10-28 11:27:17 +0000 | [diff] [blame] | 40 | "//system/timezone/input_tools/android/tzlookup_generator", |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 41 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 42 | 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 Chang | 58cfed0 | 2018-11-14 16:44:33 +0000 | [diff] [blame] | 54 | static_libs: [ |
| 55 | "icu4j-icudata", |
| 56 | "icu4j-icutzdata", |
| 57 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Victor Chang | 53ddc8d | 2020-07-28 11:44:46 +0100 | [diff] [blame] | 60 | // 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. |
| 64 | java_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 Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 71 | java_test { |
| 72 | name: "icu4j-tests", |
| 73 | defaults: ["icu4j-defaults"], |
| 74 | |
Nikita Iashchenko | c975c36 | 2019-12-19 18:00:32 +0000 | [diff] [blame] | 75 | srcs: [ |
| 76 | "main/tests/**/*.java", |
| 77 | "tools/misc/src/com/ibm/icu/dev/tool/locale/*.java", |
| 78 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 79 | 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 | |
| 91 | java_import { |
| 92 | name: "icu4j-icudata", |
| 93 | host_supported: true, |
| 94 | jars: ["main/shared/data/icudata.jar"], |
| 95 | } |
| 96 | |
| 97 | java_import { |
| 98 | name: "icu4j-icutzdata", |
| 99 | host_supported: true, |
| 100 | jars: ["main/shared/data/icutzdata.jar"], |
| 101 | } |
| 102 | |
| 103 | java_import { |
| 104 | name: "icu4j-testdata", |
| 105 | host_supported: true, |
| 106 | jars: ["main/shared/data/testdata.jar"], |
| 107 | } |
| 108 | |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 109 | // LayoutLib (frameworks/layoutlib) and robolectric need JarJar'd versions of |
| 110 | // the icudata and icutzdata, so add rules for it. |
| 111 | java_library { |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 112 | name: "icu4j-icudata-jarjar", |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 113 | visibility: [ |
| 114 | "//external/robolectric-shadows", |
| 115 | "//frameworks/layoutlib", |
| 116 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 117 | defaults: ["icu4j-defaults"], |
| 118 | static_libs: ["icu4j-icudata"], |
| 119 | jarjar_rules: "liblayout-jarjar-rules.txt", |
| 120 | } |
| 121 | |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 122 | java_library { |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 123 | name: "icu4j-icutzdata-jarjar", |
Paul Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 124 | visibility: [ |
| 125 | "//external/robolectric-shadows", |
| 126 | "//frameworks/layoutlib", |
| 127 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 128 | 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 Duffin | d772e59 | 2019-06-03 16:09:02 +0100 | [diff] [blame] | 134 | // |
| 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 Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 137 | java_library_host { |
| 138 | name: "icu4j-host", |
| 139 | static_libs: ["icu4j"], |
| 140 | } |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 141 | |
| 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. |
| 145 | generate_script_srcs = [ |
| 146 | "main/**/*", |
| 147 | "samples/**/*", |
| 148 | ] |
| 149 | generate_script_tools = [ |
| 150 | "android_icu4j_srcgen_binary", |
| 151 | "soong_zip", |
| 152 | ] |
| 153 | generate_script_tool_files = [ |
| 154 | ":generate_android_icu4j_script", |
| 155 | ] |
| 156 | // ANDROID_BUILD_TOP is needed to be set for generate_android_icu4j.sh |
| 157 | generate_script_common_cmd = "export ANDROID_BUILD_TOP=$$(pwd) && " + |
Colin Cross | d4025ce | 2018-10-05 12:35:15 -0700 | [diff] [blame] | 158 | "$(location :generate_android_icu4j_script) " + |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 159 | "--no-doc-patch " + |
| 160 | "--gen $(genDir) " + |
| 161 | "--srcgen-tool $(location android_icu4j_srcgen_binary)" |
| 162 | |
| 163 | genrule { |
| 164 | name: "generated_android_icu4j_src_files", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 165 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 166 | 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 | |
| 175 | java_genrule { |
| 176 | name: "generated_android_icu4j_resources", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 177 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 178 | 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 | |
| 188 | genrule { |
| 189 | name: "generated_android_icu4j_test_files", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 190 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 191 | 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 | |
| 201 | java_genrule { |
| 202 | name: "generated_android_icu4j_test_resources", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 203 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 204 | 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 | } |