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 | |
| 17 | java_defaults { |
| 18 | name: "icu4j-defaults", |
| 19 | host_supported: true, |
| 20 | hostdex: true, |
| 21 | |
| 22 | // Use the same Java language version in the Android build configuration as used |
| 23 | // in main/shared/build/common.properties for the ICU4J build configuration. |
Victor Chang | fdd2c3a | 2018-09-17 10:57:01 +0100 | [diff] [blame] | 24 | java_version: "1.7", |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | java_library { |
| 28 | name: "icu4j", |
| 29 | defaults: ["icu4j-defaults"], |
| 30 | |
| 31 | srcs: ["main/classes/**/*.java"], |
| 32 | java_resource_dirs: ["main/classes/*/src"], |
| 33 | |
| 34 | // User-supplied locale service providers (using the java.text.spi or |
| 35 | // java.util.spi mechanisms) are not supported in Android: |
| 36 | // |
| 37 | // http://developer.android.com/reference/java/util/Locale.html |
| 38 | exclude_srcs: ["main/classes/localespi/**/*.java"], |
| 39 | exclude_java_resource_dirs: ["main/classes/localespi/src"], |
| 40 | |
Victor Chang | 58cfed0 | 2018-11-14 16:44:33 +0000 | [diff] [blame] | 41 | static_libs: [ |
| 42 | "icu4j-icudata", |
| 43 | "icu4j-icutzdata", |
| 44 | ], |
Colin Cross | 6e18e29 | 2018-09-11 16:41:13 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | java_test { |
| 48 | name: "icu4j-tests", |
| 49 | defaults: ["icu4j-defaults"], |
| 50 | |
| 51 | srcs: ["main/tests/**/*.java"], |
| 52 | java_resource_dirs: ["main/tests/*/src"], |
| 53 | |
| 54 | exclude_srcs: ["main/tests/localespi/**/*.java"], |
| 55 | exclude_java_resource_dirs: ["main/tests/localespi/src"], |
| 56 | |
| 57 | static_libs: [ |
| 58 | "icu4j", |
| 59 | "icu4j-testdata", |
| 60 | "junit-params", |
| 61 | ], |
| 62 | } |
| 63 | |
| 64 | java_import { |
| 65 | name: "icu4j-icudata", |
| 66 | host_supported: true, |
| 67 | jars: ["main/shared/data/icudata.jar"], |
| 68 | } |
| 69 | |
| 70 | java_import { |
| 71 | name: "icu4j-icutzdata", |
| 72 | host_supported: true, |
| 73 | jars: ["main/shared/data/icutzdata.jar"], |
| 74 | } |
| 75 | |
| 76 | java_import { |
| 77 | name: "icu4j-testdata", |
| 78 | host_supported: true, |
| 79 | jars: ["main/shared/data/testdata.jar"], |
| 80 | } |
| 81 | |
| 82 | // LayoutLib (frameworks/layoutlib) needs JarJar'd versions of the |
| 83 | // icudata and icutzdata, so add rules for it. |
| 84 | java_library_static { |
| 85 | name: "icu4j-icudata-jarjar", |
| 86 | defaults: ["icu4j-defaults"], |
| 87 | static_libs: ["icu4j-icudata"], |
| 88 | jarjar_rules: "liblayout-jarjar-rules.txt", |
| 89 | } |
| 90 | |
| 91 | java_library_static { |
| 92 | name: "icu4j-icutzdata-jarjar", |
| 93 | defaults: ["icu4j-defaults"], |
| 94 | static_libs: ["icu4j-icutzdata"], |
| 95 | jarjar_rules: "liblayout-jarjar-rules.txt", |
| 96 | } |
| 97 | |
| 98 | // Compatibility alias until references to icu4j-host are removed |
| 99 | java_library_host { |
| 100 | name: "icu4j-host", |
| 101 | static_libs: ["icu4j"], |
| 102 | } |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 103 | |
| 104 | // Rules to generate android_icu4j files during build time |
| 105 | // The following rules are used in the downstream branches master-icu-dev only, |
| 106 | // but NOT used in AOSP. |
| 107 | generate_script_srcs = [ |
| 108 | "main/**/*", |
| 109 | "samples/**/*", |
| 110 | ] |
| 111 | generate_script_tools = [ |
| 112 | "android_icu4j_srcgen_binary", |
| 113 | "soong_zip", |
| 114 | ] |
| 115 | generate_script_tool_files = [ |
| 116 | ":generate_android_icu4j_script", |
| 117 | ] |
| 118 | // ANDROID_BUILD_TOP is needed to be set for generate_android_icu4j.sh |
| 119 | generate_script_common_cmd = "export ANDROID_BUILD_TOP=$$(pwd) && " + |
Colin Cross | d4025ce | 2018-10-05 12:35:15 -0700 | [diff] [blame] | 120 | "$(location :generate_android_icu4j_script) " + |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 121 | "--no-doc-patch " + |
| 122 | "--gen $(genDir) " + |
| 123 | "--srcgen-tool $(location android_icu4j_srcgen_binary)" |
| 124 | |
| 125 | genrule { |
| 126 | name: "generated_android_icu4j_src_files", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 127 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 128 | srcs: generate_script_srcs, |
| 129 | tools: generate_script_tools, |
| 130 | tool_files: generate_script_tool_files, |
| 131 | out: ["generated_android_icu4j.srcjar"], |
| 132 | cmd: generate_script_common_cmd + |
| 133 | "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/java " + |
| 134 | "-D $(genDir)/android_icu4j/src/main/java", |
| 135 | } |
| 136 | |
| 137 | java_genrule { |
| 138 | name: "generated_android_icu4j_resources", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 139 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 140 | host_supported: true, |
| 141 | srcs: generate_script_srcs, |
| 142 | tools: generate_script_tools, |
| 143 | tool_files: generate_script_tool_files, |
| 144 | out: ["generated_android_icu4j_resources.jar"], |
| 145 | cmd: generate_script_common_cmd + |
| 146 | "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/resources " + |
| 147 | "-D $(genDir)/android_icu4j/resources", |
| 148 | } |
| 149 | |
| 150 | genrule { |
| 151 | name: "generated_android_icu4j_test_files", |
Victor Chang | c25296f | 2019-03-22 22:48:10 +0000 | [diff] [blame] | 152 | enabled: false, // http://b/117312606 |
Victor Chang | e993598 | 2018-09-21 14:55:40 +0100 | [diff] [blame] | 153 | srcs: generate_script_srcs, |
| 154 | tools: generate_script_tools, |
| 155 | tool_files: generate_script_tool_files, |
| 156 | out: ["generated_android_icu4j_test.srcjar"], |
| 157 | cmd: generate_script_common_cmd + |
| 158 | "&& find $(genDir)/android_icu4j/src/main/tests -type f -not -name \"*.java\" -exec rm {} \\; " + |
| 159 | "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/tests " + |
| 160 | "-D $(genDir)/android_icu4j/src/main/tests", |
| 161 | } |
| 162 | |
| 163 | java_genrule { |
| 164 | name: "generated_android_icu4j_test_resources", |
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 | host_supported: true, |
| 167 | srcs: generate_script_srcs, |
| 168 | tools: generate_script_tools, |
| 169 | tool_files: generate_script_tool_files, |
| 170 | out: ["generated_android_icu4j_test_resources.jar"], |
| 171 | cmd: generate_script_common_cmd + |
| 172 | "&& find $(genDir)/android_icu4j/src/main/tests -type f -name \"*.java\" -exec rm {} \\; " + |
| 173 | "&& $(location soong_zip) -o $(out) -C $(genDir)/android_icu4j/src/main/tests " + |
| 174 | "-D $(genDir)/android_icu4j/src/main/tests", |
| 175 | } |