aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dicttool/Android.mk20
-rw-r--r--tools/dicttool/NativeLib.mk4
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/latin/define/JniLibName.java2
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java6
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java3
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java44
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java4
7 files changed, 24 insertions, 59 deletions
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
index 0e9c14ee4..f49dee70f 100644
--- a/tools/dicttool/Android.mk
+++ b/tools/dicttool/Android.mk
@@ -30,11 +30,12 @@ LATINIME_LOCAL_DIR := ../..
LATINIME_BASE_SOURCE_DIRECTORY := $(LATINIME_LOCAL_DIR)/java/src/com/android/inputmethod
LATINIME_ANNOTATIONS_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/annotations
MAKEDICT_CORE_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/latin/makedict
+LATINIME_TESTS_SOURCE_DIRECTORY := $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin
# Dependencies for Dicttool. Most of these files are needed by BinaryDictionary.java. Note that
# a significant part of the dependencies are mocked in the compat/ directory, with empty or
# nearly-empty implementations, for parts that we don't use in Dicttool.
-LATINIME_SRCS_FOR_DICTTOOL := \
+LATINIME_SRC_FILES_FOR_DICTTOOL := \
event/Combiner.java \
event/Event.java \
latin/BinaryDictionary.java \
@@ -47,7 +48,6 @@ LATINIME_SRCS_FOR_DICTTOOL := \
latin/WordComposer.java \
latin/settings/NativeSuggestOptions.java \
latin/utils/BinaryDictionaryUtils.java \
- latin/utils/ByteArrayDictBuffer.java \
latin/utils/CollectionUtils.java \
latin/utils/CombinedFormatUtils.java \
latin/utils/CoordinateUtils.java \
@@ -56,8 +56,13 @@ LATINIME_SRCS_FOR_DICTTOOL := \
latin/utils/LocaleUtils.java \
latin/utils/ResizableIntArray.java \
latin/utils/StringUtils.java
-USED_TARGETED_SRCS := $(addprefix $(LATINIME_BASE_SOURCE_DIRECTORY)/, \
- $(LATINIME_SRCS_FOR_DICTTOOL))
+
+LATINIME_TEST_SRC_FILES_FOR_DICTTOOL := \
+ utils/ByteArrayDictBuffer.java
+
+USED_TARGETED_SRCS := \
+ $(addprefix $(LATINIME_BASE_SOURCE_DIRECTORY)/, $(LATINIME_SRC_FILES_FOR_DICTTOOL)) \
+ $(addprefix $(LATINIME_TESTS_SOURCE_DIRECTORY)/, $(LATINIME_TEST_SRC_FILES_FOR_DICTTOOL))
DICTTOOL_ONDEVICE_TESTS_DIRECTORY := \
$(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
@@ -70,12 +75,11 @@ LOCAL_ANNOTATIONS_SRC_FILES := \
LOCAL_SRC_FILES := $(LOCAL_TOOL_SRC_FILES) \
$(filter-out $(addprefix %/, $(notdir $(LOCAL_TOOL_SRC_FILES))), $(LOCAL_MAIN_SRC_FILES)) \
- $(LOCAL_ANNOTATIONS_SRC_FILES) \
+ $(call all-java-files-under, $(DICTTOOL_COMPAT_TESTS_DIRECTORY)) \
+ $(LOCAL_ANNOTATIONS_SRC_FILES) $(USED_TARGETED_SRCS) \
$(LATINIME_BASE_SOURCE_DIRECTORY)/latin/Constants.java \
$(call all-java-files-under, tests) \
- $(call all-java-files-under, $(DICTTOOL_ONDEVICE_TESTS_DIRECTORY)) \
- $(call all-java-files-under, $(DICTTOOL_COMPAT_TESTS_DIRECTORY)) \
- $(USED_TARGETED_SRCS)
+ $(call all-java-files-under, $(DICTTOOL_ONDEVICE_TESTS_DIRECTORY))
LOCAL_JAVA_LIBRARIES := junit
LOCAL_ADDITIONAL_DEPENDENCIES := $(LATINIME_HOST_NATIVE_LIBNAME)
diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk
index 95f767dc9..0d3507be3 100644
--- a/tools/dicttool/NativeLib.mk
+++ b/tools/dicttool/NativeLib.mk
@@ -37,9 +37,9 @@ endif #HOST_JDK_IS_64BIT_VERSION
LOCAL_CFLAGS += -DHOST_TOOL -fPIC -Wno-deprecated
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
+LOCAL_CLANG := true
# For C++11
-# TODO: Change this to -std=c++11
-LOCAL_CFLAGS += -std=gnu++0x
+LOCAL_CFLAGS += -std=c++11
LATINIME_NATIVE_JNI_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni
LATINIME_NATIVE_SRC_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni/src
diff --git a/tools/dicttool/compat/com/android/inputmethod/latin/define/JniLibName.java b/tools/dicttool/compat/com/android/inputmethod/latin/define/JniLibName.java
index c68bdaabf..d6d5e2d61 100644
--- a/tools/dicttool/compat/com/android/inputmethod/latin/define/JniLibName.java
+++ b/tools/dicttool/compat/com/android/inputmethod/latin/define/JniLibName.java
@@ -21,5 +21,5 @@ public final class JniLibName {
// This class is not publicly instantiable.
}
- public static final String JNI_LIB_NAME = "latinime-dicttool-host";
+ public static final String JNI_LIB_NAME = "latinime-aosp-dicttool-host";
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
index e31ac2ab6..f9771c8dd 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.DictDecoder;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FusionDictionary;
@@ -191,8 +192,9 @@ public final class BinaryDictOffdeviceUtils {
return CombinedInputOutput.readDictionaryCombined(
new BufferedInputStream(new FileInputStream(decodedSpec.mFile)));
} else {
- final DictDecoder dictDecoder = FormatSpec.getDictDecoder(decodedSpec.mFile,
- 0, decodedSpec.mFile.length(), DictDecoder.USE_BYTEARRAY);
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(
+ decodedSpec.mFile, 0, decodedSpec.mFile.length(),
+ DictDecoder.USE_BYTEARRAY);
if (report) {
System.out.println("Format : Binary dictionary format");
System.out.println("Packaging : " + decodedSpec.describeChain());
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
index 68d785044..8e8ab19e0 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.DictDecoder;
import com.android.inputmethod.latin.makedict.DictEncoder;
import com.android.inputmethod.latin.makedict.FormatSpec;
@@ -264,7 +265,7 @@ public class DictionaryMaker {
private static FusionDictionary readBinaryFile(final String binaryFilename)
throws FileNotFoundException, IOException, UnsupportedFormatException {
final File file = new File(binaryFilename);
- final DictDecoder dictDecoder = FormatSpec.getDictDecoder(file, 0, file.length());
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(file, 0, file.length());
return dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java b/tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java
deleted file mode 100644
index 7eccff2b4..000000000
--- a/tools/dicttool/src/com/android/inputmethod/latin/makedict/MakedictLog.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.android.inputmethod.latin.makedict;
-
-/**
- * Wrapper to redirect log events to the right output medium.
- */
-public class MakedictLog {
- public static final boolean DBG = true;
-
- private static void print(String message) {
- System.out.println(message);
- }
-
- public static void d(String message) {
- print(message);
- }
-
- public static void i(String message) {
- print(message);
- }
-
- public static void w(String message) {
- print(message);
- }
-
- public static void e(String message) {
- print(message);
- }
-}
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index a3095da8a..4f1273bdc 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.latin.dicttool;
+import com.android.inputmethod.latin.Dictionary;
+import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.DictDecoder;
import com.android.inputmethod.latin.makedict.DictEncoder;
import com.android.inputmethod.latin.makedict.DictionaryHeader;
@@ -77,7 +79,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
assertEquals("Wrong decode spec", BinaryDictOffdeviceUtils.COMPRESSION, step);
}
assertEquals("Wrong decode spec", 3, decodeSpec.mDecoderSpec.size());
- final DictDecoder dictDecoder = FormatSpec.getDictDecoder(decodeSpec.mFile, 0,
+ final DictDecoder dictDecoder = BinaryDictIOUtils.getDictDecoder(decodeSpec.mFile, 0,
decodeSpec.mFile.length());
final FusionDictionary resultDict =
dictDecoder.readDictionaryBinary(false /* deleteDictIfBroken */);