aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAmin Bandali <bandali@kelar.org>2024-12-10 11:54:39 -0500
committerAmin Bandali <bandali@kelar.org>2025-01-11 14:15:56 -0500
commitfb3b9360d70596d7e921de8bf7d3ca99564a077e (patch)
tree07ded064b8374f44c6d7b88ea1c39bce09a6cdf3 /tools
parent41fd35c1412b6b3b52acdd30027c6d7ac54cd17f (diff)
downloadlatinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.tar.gz
latinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.tar.xz
latinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.zip
Initial successful standalone build
Diffstat (limited to 'tools')
-rw-r--r--tools/Android.mk15
-rw-r--r--tools/EditTextVariations/Android.mk26
-rw-r--r--tools/dicttool/Android.mk91
-rw-r--r--tools/dicttool/NativeLib.mk46
-rw-r--r--tools/dicttool/etc/Android.mk19
-rw-r--r--tools/dicttool/etc/dicttool_aosp67
-rw-r--r--tools/dicttool/etc/makedict_aosp18
-rw-r--r--tools/dicttool/etc/manifest.txt1
-rw-r--r--tools/make-keyboard-text/Android.mk25
-rw-r--r--tools/make-keyboard-text/etc/Android.mk20
-rw-r--r--tools/make-keyboard-text/etc/make-keyboard-text63
-rw-r--r--tools/make-keyboard-text/etc/manifest.txt1
12 files changed, 392 insertions, 0 deletions
diff --git a/tools/Android.mk b/tools/Android.mk
new file mode 100644
index 000000000..91b2fbbb0
--- /dev/null
+++ b/tools/Android.mk
@@ -0,0 +1,15 @@
+# Copyright (C) 2010 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.
+
+include $(call all-subdir-makefiles)
diff --git a/tools/EditTextVariations/Android.mk b/tools/EditTextVariations/Android.mk
new file mode 100644
index 000000000..1f49aa4a7
--- /dev/null
+++ b/tools/EditTextVariations/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2013 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := EditTextVariations
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
new file mode 100644
index 000000000..ee81c2a19
--- /dev/null
+++ b/tools/dicttool/Android.mk
@@ -0,0 +1,91 @@
+#
+# 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.
+
+# Only build if it's explicitly requested, or running mm/mmm.
+ifneq ($(ONE_SHOT_MAKEFILE)$(filter $(MAKECMDGOALS),dicttool_aosp),)
+
+LATINIME_DICTTOOL_AOSP_LOCAL_PATH := $(call my-dir)
+LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
+LATINIME_HOST_NATIVE_LIBNAME := jni_latinime
+include $(LOCAL_PATH)/NativeLib.mk
+
+######################################
+LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)
+include $(CLEAR_VARS)
+
+LATINIME_LOCAL_DIR := ../..
+LATINIME_BASE_SRC_DIR := $(LATINIME_LOCAL_DIR)/java/src/com/android/inputmethod
+LATINIME_BASE_OVERRIDABLE_SRC_DIR := \
+ $(LATINIME_LOCAL_DIR)/java-overridable/src/com/android/inputmethod
+MAKEDICT_CORE_SRC_DIR := $(LATINIME_BASE_SRC_DIR)/latin/makedict
+LATINIME_TESTS_SRC_DIR := $(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_SRC_FILES_FOR_DICTTOOL := \
+ latin/BinaryDictionary.java \
+ latin/DicTraverseSession.java \
+ latin/Dictionary.java \
+ latin/NgramContext.java \
+ latin/SuggestedWords.java \
+ latin/settings/SettingsValuesForSuggestion.java \
+ latin/utils/BinaryDictionaryUtils.java \
+ latin/utils/CombinedFormatUtils.java \
+ latin/utils/JniUtils.java
+
+LATINIME_OVERRIDABLE_SRC_FILES_FOR_DICTTOOL := \
+ latin/define/DebugFlags.java \
+ latin/define/DecoderSpecificConstants.java
+
+LATINIME_TEST_SRC_FILES_FOR_DICTTOOL := \
+ utils/ByteArrayDictBuffer.java \
+ makedict/Ver2DictEncoder.java \
+ makedict/Ver4DictEncoder.java \
+ makedict/BinaryDictDecoderEncoderTests.java
+
+USED_TARGETED_SRC_FILES := \
+ $(addprefix $(LATINIME_BASE_SRC_DIR)/, $(LATINIME_SRC_FILES_FOR_DICTTOOL)) \
+ $(addprefix $(LATINIME_BASE_OVERRIDABLE_SRC_DIR)/, \
+ $(LATINIME_OVERRIDABLE_SRC_FILES_FOR_DICTTOOL)) \
+ $(addprefix $(LATINIME_TESTS_SRC_DIR)/, $(LATINIME_TEST_SRC_FILES_FOR_DICTTOOL))
+
+DICTTOOL_ONDEVICE_TESTS_DIR := \
+ $(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
+DICTTOOL_COMPAT_TESTS_DIR := compat
+
+LOCAL_MAIN_SRC_FILES := $(call all-java-files-under, $(MAKEDICT_CORE_SRC_DIR))
+LOCAL_TOOL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SRC_FILES := $(LOCAL_TOOL_SRC_FILES) \
+ $(filter-out $(addprefix %/, $(notdir $(LOCAL_TOOL_SRC_FILES))), $(LOCAL_MAIN_SRC_FILES)) \
+ $(USED_TARGETED_SRC_FILES) \
+ $(call all-java-files-under, \
+ tests $(DICTTOOL_COMPAT_TESTS_DIR) $(DICTTOOL_ONDEVICE_TESTS_DIR))
+
+LOCAL_JAVA_LIBRARIES := junit-host
+LOCAL_STATIC_JAVA_LIBRARIES := jsr305lib latinime-common-host
+LOCAL_REQUIRED_MODULES := $(LATINIME_HOST_NATIVE_LIBNAME)
+LOCAL_JAR_MANIFEST := etc/manifest.txt
+LOCAL_MODULE := dicttool_aosp
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+include $(LOCAL_PATH)/etc/Android.mk
+
+# Clear our private variables
+LATINIME_DICTTOOL_AOSP_LOCAL_PATH :=
+LATINIME_LOCAL_DIR :=
+
+endif
diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk
new file mode 100644
index 000000000..510f18c4e
--- /dev/null
+++ b/tools/dicttool/NativeLib.mk
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2013 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+# Need to define the name of the library in the caller in LATINIME_HOST_NATIVE_LIBNAME
+
+LATINIME_DIR_RELATIVE_TO_DICTTOOL := ../..
+
+ifeq ($(FLAG_DBG), true)
+ $(warning Making debug version of native library)
+ LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
+endif #FLAG_DBG
+
+LOCAL_CFLAGS += -DHOST_TOOL -fPIC -Wno-deprecated -Wno-unused-parameter -Wno-unused-function
+
+LATINIME_NATIVE_JNI_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni
+LATINIME_NATIVE_SRC_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni/src
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(LATINIME_NATIVE_SRC_DIR)
+
+include $(LOCAL_PATH)/$(LATINIME_NATIVE_JNI_DIR)/NativeFileList.mk
+
+LOCAL_SRC_FILES := \
+ $(addprefix $(LATINIME_NATIVE_JNI_DIR)/, $(LATIN_IME_JNI_SRC_FILES)) \
+ $(addprefix $(LATINIME_NATIVE_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES))
+
+LOCAL_MODULE := $(LATINIME_HOST_NATIVE_LIBNAME)
+
+include $(BUILD_HOST_SHARED_LIBRARY)
+
+# Clear our private variables
+include $(LOCAL_PATH)/$(LATINIME_NATIVE_JNI_DIR)/CleanupNativeFileList.mk
+LATINIME_DIR_RELATIVE_TO_DICTTOOL := ../..
diff --git a/tools/dicttool/etc/Android.mk b/tools/dicttool/etc/Android.mk
new file mode 100644
index 000000000..0c611b7e9
--- /dev/null
+++ b/tools/dicttool/etc/Android.mk
@@ -0,0 +1,19 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_PREBUILT_EXECUTABLES := dicttool_aosp makedict_aosp
+include $(BUILD_HOST_PREBUILT)
diff --git a/tools/dicttool/etc/dicttool_aosp b/tools/dicttool/etc/dicttool_aosp
new file mode 100644
index 000000000..fc918f0f8
--- /dev/null
+++ b/tools/dicttool/etc/dicttool_aosp
@@ -0,0 +1,67 @@
+#!/bin/sh
+# Copyright 2011, 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.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/`basename "${prog}"`
+cd "${oldwd}"
+
+classname=com.android.inputmethod.latin.dicttool.Dicttool
+jarfile=dicttool_aosp.jar
+frameworkdir="$progdir"
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ frameworkdir=`dirname "$progdir"`/framework
+ libdir=`dirname "$progdir"`/lib64
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ echo `basename "$prog"`": can't find $jarfile"
+ exit 1
+fi
+
+lib=junit.jar
+if [ ! -r "$frameworkdir/$lib" ]
+then
+ echo `basename "$prog"`": can't find lib $lib"
+ exit 1
+fi
+
+if [ "$OSTYPE" = "cygwin" ] ; then
+ jarpath=`cygpath -w "$frameworkdir/$jarfile"`
+ libpath=`cygpath -w "$frameworkdir/$lib"`
+ progdir=`cygpath -w "$progdir"`
+else
+ jarpath="$frameworkdir/$jarfile"
+ libpath="$frameworkdir/$lib"
+fi
+
+# might need more memory, e.g. -Xmx128M
+exec java -ea -classpath "$libpath":"$jarpath" -Djava.library.path="$libdir" "$classname" "$@"
diff --git a/tools/dicttool/etc/makedict_aosp b/tools/dicttool/etc/makedict_aosp
new file mode 100644
index 000000000..095c50538
--- /dev/null
+++ b/tools/dicttool/etc/makedict_aosp
@@ -0,0 +1,18 @@
+#!/bin/sh
+# 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.
+
+# Dicttool supports making the dictionary using the 'makedict' command and
+# the same arguments that the old 'makedict' command used to accept.
+dicttool_aosp makedict $@
diff --git a/tools/dicttool/etc/manifest.txt b/tools/dicttool/etc/manifest.txt
new file mode 100644
index 000000000..67c85214c
--- /dev/null
+++ b/tools/dicttool/etc/manifest.txt
@@ -0,0 +1 @@
+Main-Class: com.android.inputmethod.latin.dicttool.Dicttool
diff --git a/tools/make-keyboard-text/Android.mk b/tools/make-keyboard-text/Android.mk
new file mode 100644
index 000000000..87601489e
--- /dev/null
+++ b/tools/make-keyboard-text/Android.mk
@@ -0,0 +1,25 @@
+#
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES += $(call all-java-files-under,src)
+LOCAL_JAR_MANIFEST := etc/manifest.txt
+LOCAL_JAVA_RESOURCE_DIRS := res
+LOCAL_MODULE := make-keyboard-text
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+include $(LOCAL_PATH)/etc/Android.mk
diff --git a/tools/make-keyboard-text/etc/Android.mk b/tools/make-keyboard-text/etc/Android.mk
new file mode 100644
index 000000000..0fbf4ffe9
--- /dev/null
+++ b/tools/make-keyboard-text/etc/Android.mk
@@ -0,0 +1,20 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_PREBUILT_EXECUTABLES := make-keyboard-text
+
+include $(BUILD_HOST_PREBUILT)
diff --git a/tools/make-keyboard-text/etc/make-keyboard-text b/tools/make-keyboard-text/etc/make-keyboard-text
new file mode 100644
index 000000000..156f9ec5f
--- /dev/null
+++ b/tools/make-keyboard-text/etc/make-keyboard-text
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright 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.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/`basename "${prog}"`
+cd "${oldwd}"
+
+jarfile=make-keyboard-text.jar
+frameworkdir="$progdir"
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ frameworkdir=`dirname "$progdir"`/tools/lib
+ libdir=`dirname "$progdir"`/tools/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ frameworkdir=`dirname "$progdir"`/framework
+ libdir=`dirname "$progdir"`/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+ echo `basename "$prog"`": can't find $jarfile"
+ exit 1
+fi
+
+if [ "$OSTYPE" = "cygwin" ] ; then
+ jarpath=`cygpath -w "$frameworkdir/$jarfile"`
+ progdir=`cygpath -w "$progdir"`
+else
+ jarpath="$frameworkdir/$jarfile"
+fi
+
+# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
+# might need more memory, e.g. -Xmx128M
+exec java -ea -jar "$jarpath" "$@"
diff --git a/tools/make-keyboard-text/etc/manifest.txt b/tools/make-keyboard-text/etc/manifest.txt
new file mode 100644
index 000000000..8ad4db059
--- /dev/null
+++ b/tools/make-keyboard-text/etc/manifest.txt
@@ -0,0 +1 @@
+Main-Class: com.android.inputmethod.keyboard.tools.MakeKeyboardText