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 LOCAL_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 24 icu4j_src_files := \ 25 $(filter-out main/classes/localespi/%, \ 26 $(call all-java-files-under,main/classes)) 27 28 icu4j_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 36 define all-subdir-with-subdir 37 $(patsubst $(LOCAL_PATH)/%/$(2),%,$(wildcard $(LOCAL_PATH)/$(1)/$(2))) 38 endef 39 40 icu4j_resource_dirs := \ 41 $(filter-out main/classes/localespi/%, \ 42 $(call all-subdir-with-subdir,main/classes/*/src,com/ibm/icu)) 43 44 icu4j_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. 49 icu4j_data_jars := \ 50 $(foreach j,$(call all-named-files-under,*.jar,main/shared/data),icu4j-$(basename $(notdir $(j))):$(j)) 51 52 include $(CLEAR_VARS) 53 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(icu4j_data_jars) 54 include $(BUILD_MULTI_PREBUILT) 55 56 include $(CLEAR_VARS) 57 LOCAL_IS_HOST_MODULE := true 58 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := $(subst :,-host:,$(icu4j_data_jars)) 59 include $(BUILD_MULTI_PREBUILT) 60 61 include $(CLEAR_VARS) 62 LOCAL_SRC_FILES := $(icu4j_src_files) 63 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs) 64 LOCAL_MODULE := icu4j 65 include $(BUILD_STATIC_JAVA_LIBRARY) 66 67 # Path to the ICU4C data files in the Android device file system: 68 icu4c_data := /system/usr/icu 69 icu4j_config_root := $(LOCAL_PATH)/main/classes/core/src 70 include external/icu/icu4j/adjust_icudt_path.mk 71 72 include $(CLEAR_VARS) 73 LOCAL_SRC_FILES := $(icu4j_src_files) 74 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs) 75 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host 76 LOCAL_MODULE := icu4j-host 77 include $(BUILD_HOST_JAVA_LIBRARY) 78 79 ifeq ($(HOST_OS),linux) 80 include $(CLEAR_VARS) 81 LOCAL_SRC_FILES := $(icu4j_src_files) 82 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_resource_dirs) 83 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host icu4j-icutzdata-host 84 LOCAL_MODULE := icu4j-hostdex 85 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 86 endif # HOST_OS == linux 87 88 include $(CLEAR_VARS) 89 LOCAL_SRC_FILES := $(icu4j_test_src_files) 90 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs) 91 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata 92 LOCAL_JAVA_LIBRARIES := icu4j junit junit-params 93 LOCAL_MODULE := icu4j-tests 94 include $(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 #========================================================== 106 include $(CLEAR_VARS) 107 LOCAL_SRC_FILES := $(icu4j_test_src_files) 108 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs) 109 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host 110 LOCAL_JAVA_LIBRARIES := icu4j-host junit-host junit-params-host 111 LOCAL_MODULE := icu4j-tests-host 112 include $(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 118 ifeq ($(HOST_OS),linux) 119 include $(CLEAR_VARS) 120 LOCAL_SRC_FILES := $(icu4j_test_src_files) 121 LOCAL_JAVA_RESOURCE_DIRS := $(icu4j_test_resource_dirs) 122 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-testdata-host 123 LOCAL_JAVA_LIBRARIES := icu4j-hostdex junit-hostdex junit-params-hostdex 124 LOCAL_MODULE := icu4j-tests-hostdex 125 include $(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 131 endif # 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. 135 include $(CLEAR_VARS) 136 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata-host 137 LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt 138 LOCAL_MODULE := icu4j-icudata-host-jarjar 139 # Pin java_version until jarjar is certified to support later versions. http://b/72703434 140 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 141 include $(BUILD_HOST_JAVA_LIBRARY) 142 143 include $(CLEAR_VARS) 144 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icudata 145 LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt 146 LOCAL_MODULE := icu4j-icudata-jarjar 147 # Pin java_version until jarjar is certified to support later versions. http://b/72703434 148 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 149 include $(BUILD_STATIC_JAVA_LIBRARY) 150 151 include $(CLEAR_VARS) 152 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata-host 153 LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt 154 LOCAL_MODULE := icu4j-icutzdata-host-jarjar 155 # Pin java_version until jarjar is certified to support later versions. http://b/72703434 156 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 157 include $(BUILD_HOST_JAVA_LIBRARY) 158 159 include $(CLEAR_VARS) 160 LOCAL_STATIC_JAVA_LIBRARIES := icu4j-icutzdata 161 LOCAL_JARJAR_RULES := $(LOCAL_PATH)/liblayout-jarjar-rules.txt 162 LOCAL_MODULE := icu4j-icutzdata-jarjar 163 # Pin java_version until jarjar is certified to support later versions. http://b/72703434 164 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 165 include $(BUILD_STATIC_JAVA_LIBRARY) 166