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    $(shell find $(LOCAL_PATH)/main/shared/data -name "*.jar" \
51    | sed "s,^$(LOCAL_PATH)/\(.*/\(.*\)\.jar\)$$,icu4j-\2:\1,")
52
53include $(CLEAR_VARS)
54LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(icu4j_data_jars)
55include $(BUILD_MULTI_PREBUILT)
56
57include $(CLEAR_VARS)
58LOCAL_IS_HOST_MODULE := true
59LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(subst :,-host:,$(icu4j_data_jars))
60include $(BUILD_MULTI_PREBUILT)
61
62include $(CLEAR_VARS)
63LOCAL_SRC_FILES := $(icu4j_src_files)
64LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
65LOCAL_DONT_DELETE_JAR_DIRS := true
66LOCAL_MODULE := icu4j
67include $(BUILD_STATIC_JAVA_LIBRARY)
68
69# Path to the ICU4C data files in the Android device file system:
70icu4c_data := /system/usr/icu
71icu4j_config_root := $(LOCAL_PATH)/main/classes/core/src
72include external/icu/icu4j/adjust_icudt_path.mk
73
74include $(CLEAR_VARS)
75LOCAL_STATIC_JAVA_LIBRARIES := icu4j
76LOCAL_DONT_DELETE_JAR_DIRS := true
77LOCAL_MODULE := icu4j-jarjar
78LOCAL_JARJAR_RULES := $(TOP)/libcore/jarjar-rules.txt
79include $(BUILD_STATIC_JAVA_LIBRARY)
80
81include $(CLEAR_VARS)
82LOCAL_SRC_FILES := $(icu4j_src_files)
83LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
84LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
85LOCAL_DONT_DELETE_JAR_DIRS := true
86LOCAL_MODULE := icu4j-host
87include $(BUILD_HOST_JAVA_LIBRARY)
88
89ifeq ($(HOST_OS),linux)
90include $(CLEAR_VARS)
91LOCAL_SRC_FILES := $(icu4j_src_files)
92LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs)
93LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host
94LOCAL_DONT_DELETE_JAR_DIRS := true
95LOCAL_MODULE := icu4j-hostdex
96include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
97endif  # HOST_OS == linux
98
99include $(CLEAR_VARS)
100LOCAL_SRC_FILES := $(icu4j_test_src_files)
101LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
102LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata
103LOCAL_DONT_DELETE_JAR_DIRS := true
104LOCAL_JAVA_LIBRARIES := icu4j
105LOCAL_MODULE := icu4j-tests
106include $(BUILD_STATIC_JAVA_LIBRARY)
107
108$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
109    -C "$(LOCAL_PATH)/main/tests/core/src" \
110    "com/ibm/icu/dev/test/serializable/data"
111
112include $(CLEAR_VARS)
113LOCAL_SRC_FILES := $(icu4j_test_src_files)
114LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
115LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
116LOCAL_DONT_DELETE_JAR_DIRS := true
117LOCAL_JAVA_LIBRARIES := icu4j-host
118LOCAL_MODULE := icu4j-tests-host
119include $(BUILD_HOST_JAVA_LIBRARY)
120
121$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
122    -C "$(LOCAL_PATH)/main/tests/core/src" \
123    "com/ibm/icu/dev/test/serializable/data"
124
125ifeq ($(HOST_OS),linux)
126include $(CLEAR_VARS)
127LOCAL_SRC_FILES := $(icu4j_test_src_files)
128LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs)
129LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host
130LOCAL_DONT_DELETE_JAR_DIRS := true
131LOCAL_JAVA_LIBRARIES := icu4j-hostdex
132LOCAL_MODULE := icu4j-tests-hostdex
133include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
134
135$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS += \
136    -C "$(LOCAL_PATH)/main/tests/core/src" \
137    "com/ibm/icu/dev/test/serializable/data"
138
139endif  # HOST_OS == linux
140
141# LayoutLib (frameworks/base/tools/layoutlib) needs JarJar'd versions of the
142# icudata and icutzdata, so add rules for it.
143include $(CLEAR_VARS)
144LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata
145LOCAL_JARJAR_RULES := $(TOP)/libcore/jarjar-rules.txt
146LOCAL_JACK_ENABLED := disabled
147LOCAL_MODULE := icu4j-icudata-jarjar
148include $(BUILD_STATIC_JAVA_LIBRARY)
149
150include $(CLEAR_VARS)
151LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata
152LOCAL_JARJAR_RULES := $(TOP)/libcore/jarjar-rules.txt
153LOCAL_JACK_ENABLED := disabled
154LOCAL_MODULE := icu4j-icutzdata-jarjar
155include $(BUILD_STATIC_JAVA_LIBRARY)
156