1bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
2bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# Copyright (C) 2014 The Android Open Source Project
3bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
4bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# Licensed under the Apache License, Version 2.0 (the "License");
5bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# you may not use this file except in compliance with the License.
6bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# You may obtain a copy of the License at
7bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
8bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#      http://www.apache.org/licenses/LICENSE-2.0
9bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
10bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# Unless required by applicable law or agreed to in writing, software
11bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# distributed under the License is distributed on an "AS IS" BASIS,
12bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# See the License for the specific language governing permissions and
14bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# limitations under the License.
15bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
16bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
17bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_PATH := $(call my-dir)
18bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
19bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# User-supplied locale service providers (using the java.text.spi or
20bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# java.util.spi mechanisms) are not supported in Android:
21bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert#
22bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# http://developer.android.com/reference/java/util/Locale.html
23bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
24bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Rouberticu4j_src_files := \
25bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(filter-out main/classes/localespi/%, \
26bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(call all-java-files-under,main/classes))
27bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
28bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Rouberticu4j_test_src_files := \
29bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(filter-out main/tests/localespi/%, \
30bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(call all-java-files-under,main/tests))
31bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
32bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# Not all src dirs contain resources, some instead contain other random files
33bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# that should not be included as resources. The ones that should be included
34bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# can be identifed by the fact that they contain particular subdir trees.
35bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
36bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertdefine all-subdir-with-subdir
37bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert$(patsubst $(LOCAL_PATH)/%/$(2),%,$(wildcard $(LOCAL_PATH)/$(1)/$(2)))
38bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertendef
39bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
40bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Rouberticu4j_resource_dirs := \
41bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(filter-out main/classes/localespi/%, \
42bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(call all-subdir-with-subdir,main/classes/*/src,com/ibm/icu))
43bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
44bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Rouberticu4j_test_resource_dirs := \
45bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert    $(filter-out main/tests/localespi/%, \
466a1165cf132bca722c18a38410b5382f2e05ee01Fredrik Roubert    $(call all-subdir-with-subdir,main/tests/*/src,com/ibm/icu/dev))
47bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
48bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert# For each data *.jar file, define a corresponding icu4j-* target.
49bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Rouberticu4j_data_jars := \
50f61d3550a29ff12932cfe049332f4e39787cf3ccDan Willemsen    $(foreach j,$(call all-named-files-under,*.jar,main/shared/data),icu4j-$(basename $(notdir $(j))):$(j))
51bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
52bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
53bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(icu4j_data_jars)
54bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(BUILD_MULTI_PREBUILT)
55bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
56bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
57bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_IS_HOST_MODULE := true
58773a976b65a57fa6d9410613041c9b4d76b817ddFredrik RoubertLOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(subst :,-host:,$(icu4j_data_jars))
59bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(BUILD_MULTI_PREBUILT)
60bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
61bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
62bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_SRC_FILES := $(icu4j_src_files)
63bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
64bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_MODULE := icu4j
65bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(BUILD_STATIC_JAVA_LIBRARY)
66bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
671e80f222e36e743108369986a135450f2d463ff1Narayan Kamath# Path to the ICU4C data files in the Android device file system:
681e80f222e36e743108369986a135450f2d463ff1Narayan Kamathicu4c_data := /system/usr/icu
691e80f222e36e743108369986a135450f2d463ff1Narayan Kamathicu4j_config_root := $(LOCAL_PATH)/main/classes/core/src
701e80f222e36e743108369986a135450f2d463ff1Narayan Kamathinclude external/icu/icu4j/adjust_icudt_path.mk
711e8701d9e349e6abd8d603a8dbaec90709ccc19dFredrik Roubert
72bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
73bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_SRC_FILES := $(icu4j_src_files)
74bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
75773a976b65a57fa6d9410613041c9b4d76b817ddFredrik RoubertLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
765e909ac058631d7c3dd704a0562b3b34c0629209Fredrik RoubertLOCAL_MODULE := icu4j-host
775e909ac058631d7c3dd704a0562b3b34c0629209Fredrik Roubertinclude $(BUILD_HOST_JAVA_LIBRARY)
78bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
7913ebed34a5d5a6eb58e3f95ac24a96d4fb3e9deeNarayan Kamathifeq ($(HOST_OS),linux)
80bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
81b891cb0330449b41281c41ed94d7657ccbcc0802Narayan KamathLOCAL_SRC_FILES := $(icu4j_src_files)
82b891cb0330449b41281c41ed94d7657ccbcc0802Narayan KamathLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
83773a976b65a57fa6d9410613041c9b4d76b817ddFredrik RoubertLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
845e909ac058631d7c3dd704a0562b3b34c0629209Fredrik RoubertLOCAL_MODULE := icu4j-hostdex
855e909ac058631d7c3dd704a0562b3b34c0629209Fredrik Roubertinclude $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
8613ebed34a5d5a6eb58e3f95ac24a96d4fb3e9deeNarayan Kamathendif  # HOST_OS == linux
87b891cb0330449b41281c41ed94d7657ccbcc0802Narayan Kamath
88b891cb0330449b41281c41ed94d7657ccbcc0802Narayan Kamathinclude $(CLEAR_VARS)
89bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_SRC_FILES := $(icu4j_test_src_files)
90bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
91bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata
92a1404957794307b26108d8441481e3a863ddb0fbFredrik RoubertLOCAL_JAVA_LIBRARIES := icu4j junit junit-params
93bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_MODULE := icu4j-tests
94bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(BUILD_STATIC_JAVA_LIBRARY)
95bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubert
966acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
976acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    -C "$(LOCAL_PATH)/main/tests/core/src" \
986acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    "com/ibm/icu/dev/test/serializable/data"
996acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert
100925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin#==========================================================
101925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin# build ICU tests for host for testing purposes
102925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin#
103925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin# Run the tests using the ICU4J test framework with the following command:
104925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin#   java -cp ${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/icu4j-host.jar:${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/icu4j-tests-host.jar com.ibm.icu.dev.test.TestAll
105925333c86264c3e4986a5f8e0c3c096df29b578cPaul Duffin#==========================================================
106bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(CLEAR_VARS)
107bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_SRC_FILES := $(icu4j_test_src_files)
108bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
109773a976b65a57fa6d9410613041c9b4d76b817ddFredrik RoubertLOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
1105500bae166220f7cfe3c653591570f3bc173ba68Fredrik RoubertLOCAL_JAVA_LIBRARIES := icu4j-host junit-host junit-params-host
111f99925591f9906f8d08f1bb65bd415cd51861617Narayan KamathLOCAL_MODULE := icu4j-tests-host
112f99925591f9906f8d08f1bb65bd415cd51861617Narayan Kamathinclude $(BUILD_HOST_JAVA_LIBRARY)
113f99925591f9906f8d08f1bb65bd415cd51861617Narayan Kamath
1146acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
1156acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    -C "$(LOCAL_PATH)/main/tests/core/src" \
1166acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    "com/ibm/icu/dev/test/serializable/data"
1176acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert
11813ebed34a5d5a6eb58e3f95ac24a96d4fb3e9deeNarayan Kamathifeq ($(HOST_OS),linux)
119f99925591f9906f8d08f1bb65bd415cd51861617Narayan Kamathinclude $(CLEAR_VARS)
120f99925591f9906f8d08f1bb65bd415cd51861617Narayan KamathLOCAL_SRC_FILES := $(icu4j_test_src_files)
121f99925591f9906f8d08f1bb65bd415cd51861617Narayan KamathLOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
122773a976b65a57fa6d9410613041c9b4d76b817ddFredrik RoubertLOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
1231680a663a71c55d7cd6271b7d4f21168af342379Fredrik RoubertLOCAL_JAVA_LIBRARIES := icu4j-hostdex junit-hostdex junit-params-hostdex
124bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik RoubertLOCAL_MODULE := icu4j-tests-hostdex
125bda1c8664cd13a84d000ff94fc59145e83a49f43Fredrik Roubertinclude $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
1266acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert
1276acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
1286acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    -C "$(LOCAL_PATH)/main/tests/core/src" \
1296acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert    "com/ibm/icu/dev/test/serializable/data"
1306acb956d96bbc1969da9ae5825097298da4a2c91Fredrik Roubert
13113ebed34a5d5a6eb58e3f95ac24a96d4fb3e9deeNarayan Kamathendif  # HOST_OS == linux
13259dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Gupta
13359dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Gupta# LayoutLib (frameworks/base/tools/layoutlib) needs JarJar'd versions of the
13459dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Gupta# icudata and icutzdata, so add rules for it.
13559dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Guptainclude $(CLEAR_VARS)
136e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil FullerLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host
1378323c49fc225f42b55d799fc85941b1f4233698aNeil FullerLOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
138e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil FullerLOCAL_MODULE := icu4j-icudata-host-jarjar
139b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias Thierer# Pin java_version until jarjar is certified to support later versions. http://b/72703434
140b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias ThiererLOCAL_JAVA_LANGUAGE_VERSION := 1.8
141e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil Fullerinclude $(BUILD_HOST_JAVA_LIBRARY)
14259dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Gupta
14359dfc3cc05378055038fe98bce6f6740e5a120deDeepanshu Guptainclude $(CLEAR_VARS)
144dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias ThiererLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata
145dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias ThiererLOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
146dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias ThiererLOCAL_MODULE := icu4j-icudata-jarjar
147b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias Thierer# Pin java_version until jarjar is certified to support later versions. http://b/72703434
148b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias ThiererLOCAL_JAVA_LANGUAGE_VERSION := 1.8
149dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias Thiererinclude $(BUILD_STATIC_JAVA_LIBRARY)
150dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias Thierer
151dc0a4e8634c0196e913c97c11c9f0d4c5ff1876bTobias Thiererinclude $(CLEAR_VARS)
152e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil FullerLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata-host
1538323c49fc225f42b55d799fc85941b1f4233698aNeil FullerLOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
154e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil FullerLOCAL_MODULE := icu4j-icutzdata-host-jarjar
155b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias Thierer# Pin java_version until jarjar is certified to support later versions. http://b/72703434
156b3db89a2658693a19c93933fbb7c15edc61aaf3eTobias ThiererLOCAL_JAVA_LANGUAGE_VERSION := 1.8
157e553e2b7488962c638a61d0398ca3ed1e5a379bbNeil Fullerinclude $(BUILD_HOST_JAVA_LIBRARY)
15875041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias Thierer
15975041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias Thiererinclude $(CLEAR_VARS)
16075041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias ThiererLOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata
16175041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias ThiererLOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
16275041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias ThiererLOCAL_MODULE := icu4j-icutzdata-jarjar
16375041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias Thierer# Pin java_version until jarjar is certified to support later versions. http://b/72703434
16475041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias ThiererLOCAL_JAVA_LANGUAGE_VERSION := 1.8
16575041df95071c67e2eb2e6cdf5f4300dfd626dd9Tobias Thiererinclude $(BUILD_STATIC_JAVA_LIBRARY)
166