• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17LOCAL_PATH := $(call my-dir)
18
19# User-supplied locale service providers (using the java.text.spi or
20# java.util.spi mechanisms) are not supported in Android:
21#
22# http://developer.android.com/reference/java/util/Locale.html
23
24icu4j_src_files := \
25    $(filter-out main/classes/localespi/%, \
26    $(call all-java-files-under,main/classes))
27
28icu4j_test_src_files := \
29    $(filter-out main/tests/localespi/%, \
30    $(call all-java-files-under,main/tests))
31
32# Not all src dirs contain resources, some instead contain other random files
33# that should not be included as resources. The ones that should be included
34# can be identifed by the fact that they contain particular subdir trees.
35
36define all-subdir-with-subdir
37$(patsubst $(LOCAL_PATH)/%/$(2),%,$(wildcard $(LOCAL_PATH)/$(1)/$(2)))
38endef
39
40icu4j_resource_dirs := \
41    $(filter-out main/classes/localespi/%, \
42    $(call all-subdir-with-subdir,main/classes/*/src,com/ibm/icu))
43
44icu4j_test_resource_dirs := \
45    $(filter-out main/tests/localespi/%, \
46    $(call all-subdir-with-subdir,main/tests/*/src,com/ibm/icu/dev))
47
48# For each data *.jar file, define a corresponding icu4j-* target.
49icu4j_data_jars := \
50    $(foreach j,$(call all-named-files-under,*.jar,main/shared/data),icu4j-$(basename $(notdir $(j))):$(j))
51
52include $(CLEAR_VARS)
53LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(icu4j_data_jars)
54include $(BUILD_MULTI_PREBUILT)
55
56include $(CLEAR_VARS)
57LOCAL_IS_HOST_MODULE := true
58LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(subst :,-host:,$(icu4j_data_jars))
59include $(BUILD_MULTI_PREBUILT)
60
61include $(CLEAR_VARS)
62LOCAL_SRC_FILES := $(icu4j_src_files)
63LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
64LOCAL_MODULE := icu4j
65include $(BUILD_STATIC_JAVA_LIBRARY)
66
67# Path to the ICU4C data files in the Android device file system:
68icu4c_data := /system/usr/icu
69icu4j_config_root := $(LOCAL_PATH)/main/classes/core/src
70include external/icu/icu4j/adjust_icudt_path.mk
71
72include $(CLEAR_VARS)
73LOCAL_SRC_FILES := $(icu4j_src_files)
74LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
75LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
76LOCAL_MODULE := icu4j-host
77include $(BUILD_HOST_JAVA_LIBRARY)
78
79ifeq ($(HOST_OS),linux)
80include $(CLEAR_VARS)
81LOCAL_SRC_FILES := $(icu4j_src_files)
82LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
83LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
84LOCAL_MODULE := icu4j-hostdex
85include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
86endif  # HOST_OS == linux
87
88include $(CLEAR_VARS)
89LOCAL_SRC_FILES := $(icu4j_test_src_files)
90LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
91LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata
92LOCAL_JAVA_LIBRARIES := icu4j junit junit-params
93LOCAL_MODULE := icu4j-tests
94include $(BUILD_STATIC_JAVA_LIBRARY)
95
96$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
97    -C "$(LOCAL_PATH)/main/tests/core/src" \
98    "com/ibm/icu/dev/test/serializable/data"
99
100#==========================================================
101# build ICU tests for host for testing purposes
102#
103# Run the tests using the ICU4J test framework with the following command:
104#   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
105#==========================================================
106include $(CLEAR_VARS)
107LOCAL_SRC_FILES := $(icu4j_test_src_files)
108LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
109LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
110LOCAL_JAVA_LIBRARIES := icu4j-host junit-host junit-params-host
111LOCAL_MODULE := icu4j-tests-host
112include $(BUILD_HOST_JAVA_LIBRARY)
113
114$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
115    -C "$(LOCAL_PATH)/main/tests/core/src" \
116    "com/ibm/icu/dev/test/serializable/data"
117
118ifeq ($(HOST_OS),linux)
119include $(CLEAR_VARS)
120LOCAL_SRC_FILES := $(icu4j_test_src_files)
121LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
122LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
123LOCAL_JAVA_LIBRARIES := icu4j-hostdex junit-hostdex junit-params-hostdex
124LOCAL_MODULE := icu4j-tests-hostdex
125include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
126
127$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
128    -C "$(LOCAL_PATH)/main/tests/core/src" \
129    "com/ibm/icu/dev/test/serializable/data"
130
131endif  # HOST_OS == linux
132
133# LayoutLib (frameworks/base/tools/layoutlib) needs JarJar'd versions of the
134# icudata and icutzdata, so add rules for it.
135include $(CLEAR_VARS)
136LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host
137LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
138LOCAL_MODULE := icu4j-icudata-host-jarjar
139include $(BUILD_HOST_JAVA_LIBRARY)
140
141include $(CLEAR_VARS)
142LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata-host
143LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt
144LOCAL_MODULE := icu4j-icutzdata-host-jarjar
145include $(BUILD_HOST_JAVA_LIBRARY)
146