diff options
author | 2024-12-10 11:54:39 -0500 | |
---|---|---|
committer | 2025-01-11 14:15:56 -0500 | |
commit | fb3b9360d70596d7e921de8bf7d3ca99564a077e (patch) | |
tree | 07ded064b8374f44c6d7b88ea1c39bce09a6cdf3 /native | |
parent | 41fd35c1412b6b3b52acdd30027c6d7ac54cd17f (diff) | |
download | latinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.tar.gz latinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.tar.xz latinime-fb3b9360d70596d7e921de8bf7d3ca99564a077e.zip |
Initial successful standalone build
Diffstat (limited to 'native')
-rw-r--r-- | native/Android.mk | 1 | ||||
-rw-r--r-- | native/dicttoolkit/Android.mk | 66 | ||||
-rw-r--r-- | native/dicttoolkit/CleanupNativeFileList.mk | 17 | ||||
-rw-r--r-- | native/dicttoolkit/NativeFileList.mk | 44 | ||||
-rw-r--r-- | native/dicttoolkit/UnitTests.mk | 65 | ||||
-rw-r--r-- | native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h | 2 | ||||
-rw-r--r-- | native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node.h | 2 | ||||
-rw-r--r-- | native/dicttoolkit/tests/offdevice_intermediate_dict/offdevice_intermediate_dict_test.cpp | 2 | ||||
-rw-r--r-- | native/jni/Android.mk | 98 | ||||
-rw-r--r-- | native/jni/Application.mk | 1 | ||||
-rw-r--r-- | native/jni/CleanupNativeFileList.mk | 19 | ||||
-rw-r--r-- | native/jni/NativeFileList.mk | 146 | ||||
-rw-r--r-- | native/jni/TargetUnitTests.mk | 50 |
13 files changed, 510 insertions, 3 deletions
diff --git a/native/Android.mk b/native/Android.mk new file mode 100644 index 000000000..5053e7d64 --- /dev/null +++ b/native/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/native/dicttoolkit/Android.mk b/native/dicttoolkit/Android.mk new file mode 100644 index 000000000..7a446860c --- /dev/null +++ b/native/dicttoolkit/Android.mk @@ -0,0 +1,66 @@ +# Copyright (C) 2014 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. + +ifeq (,$(TARGET_BUILD_APPS)) + +# Only build if it's explicitly requested, or running mm/mmm. +ifneq ($(ONE_SHOT_MAKEFILE)$(filter $(MAKECMDGOALS),dicttoolkit),) + +# HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11. +LATINIME_HOST_OSNAME := $(shell uname -s) +ifneq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LATIN_IME_CORE_PATH := $(LOCAL_PATH)/../jni + +LATIN_IME_DICT_TOOLKIT_SRC_DIR := src +LATIN_IME_CORE_SRC_DIR := ../jni/src + +LOCAL_CFLAGS += -Werror -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \ + -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls \ + -Woverloaded-virtual -Wsign-promo -Wno-system-headers + +# To suppress compiler warnings for unused variables/functions used for debug features etc. +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function + +include $(LOCAL_PATH)/NativeFileList.mk +include $(LATIN_IME_CORE_PATH)/NativeFileList.mk + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_DICT_TOOLKIT_SRC_DIR) \ + $(LATIN_IME_CORE_PATH)/$(LATIN_IME_CORE_SRC_DIR) + +LOCAL_SRC_FILES := $(LATIN_IME_DICT_TOOLKIT_MAIN_SRC_FILES) \ + $(addprefix $(LATIN_IME_DICT_TOOLKIT_SRC_DIR)/, $(LATIN_IME_DICT_TOOLKIT_SRC_FILES)) \ + $(addprefix $(LATIN_IME_CORE_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES)) + +LOCAL_MODULE := dicttoolkit +LOCAL_MODULE_TAGS := optional + +LOCAL_CXX_STL := libc++ + +include $(BUILD_HOST_EXECUTABLE) +#################### Clean up the tmp vars +include $(LOCAL_PATH)/CleanupNativeFileList.mk +#################### Unit test +include $(LOCAL_PATH)/UnitTests.mk + +endif # Darwin - TODO: Remove this + +endif + +endif # TARGET_BUILD_APPS diff --git a/native/dicttoolkit/CleanupNativeFileList.mk b/native/dicttoolkit/CleanupNativeFileList.mk new file mode 100644 index 000000000..b804b41ed --- /dev/null +++ b/native/dicttoolkit/CleanupNativeFileList.mk @@ -0,0 +1,17 @@ +# Copyright (C) 2014 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. + +LATIN_IME_DICT_TOOLKIT_MAIN_SRC_FILES := +LATIN_IME_DICT_TOOLKIT_SRC_FILES := +LATIN_IME_DICT_TOOLKIT_TEST_FILES := diff --git a/native/dicttoolkit/NativeFileList.mk b/native/dicttoolkit/NativeFileList.mk new file mode 100644 index 000000000..9a547b054 --- /dev/null +++ b/native/dicttoolkit/NativeFileList.mk @@ -0,0 +1,44 @@ +# Copyright (C) 2014 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. + +LATIN_IME_DICT_TOOLKIT_MAIN_SRC_FILES := \ + dict_toolkit_main.cpp + +LATIN_IME_DICT_TOOLKIT_SRC_FILES := \ + $(addprefix command_executors/, \ + diff_executor.cpp \ + header_executor.cpp \ + help_executor.cpp \ + info_executor.cpp \ + makedict_executor.cpp) \ + $(addprefix offdevice_intermediate_dict/, \ + offdevice_intermediate_dict.cpp) \ + $(addprefix utils/, \ + arguments_parser.cpp \ + command_utils.cpp \ + utf8_utils.cpp) + +LATIN_IME_DICT_TOOLKIT_TEST_FILES := \ + $(addprefix command_executors/, \ + diff_executor_test.cpp \ + header_executor_test.cpp \ + info_executor_test.cpp \ + makedict_executor_test.cpp) \ + dict_toolkit_defines_test.cpp \ + $(addprefix offdevice_intermediate_dict/, \ + offdevice_intermediate_dict_test.cpp) \ + $(addprefix utils/, \ + arguments_parser_test.cpp \ + command_utils_test.cpp \ + utf8_utils_test.cpp) diff --git a/native/dicttoolkit/UnitTests.mk b/native/dicttoolkit/UnitTests.mk new file mode 100644 index 000000000..55177c084 --- /dev/null +++ b/native/dicttoolkit/UnitTests.mk @@ -0,0 +1,65 @@ +# Copyright (C) 2014 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. + +ifeq (,$(TARGET_BUILD_APPS)) + +LOCAL_PATH := $(call my-dir) + +###################################### +include $(CLEAR_VARS) + +LATIN_IME_CORE_PATH := $(LOCAL_PATH)/../jni + +LATIN_IME_DICT_TOOLKIT_SRC_DIR := src +LATIN_IME_CORE_SRC_DIR := ../jni/src +LATIN_DICT_TOOLKIT_TEST_SRC_DIR := tests + +include $(LOCAL_PATH)/NativeFileList.mk +include $(LATIN_IME_CORE_PATH)/NativeFileList.mk + +LATIN_IME_SRC_DIR := src +LOCAL_ADDRESS_SANITIZER := true +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function +LOCAL_CXX_STL := libc++ +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_DICT_TOOLKIT_SRC_DIR) \ + $(LATIN_IME_CORE_PATH)/$(LATIN_IME_CORE_SRC_DIR) +LOCAL_MODULE := liblatinime_dicttoolkit_host_static_for_unittests +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := \ + $(addprefix $(LATIN_IME_DICT_TOOLKIT_SRC_DIR)/, $(LATIN_IME_DICT_TOOLKIT_SRC_FILES)) \ + $(addprefix $(LATIN_IME_CORE_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES)) +include $(BUILD_HOST_STATIC_LIBRARY) + +include $(CLEAR_VARS) + +LOCAL_ADDRESS_SANITIZER := true +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function +LOCAL_CXX_STL := libc++ +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_DICT_TOOLKIT_SRC_DIR) \ + $(LATIN_IME_CORE_PATH)/$(LATIN_IME_CORE_SRC_DIR) +LOCAL_MODULE := dicttoolkit_unittests +LOCAL_MODULE_TAGS := tests +LOCAL_SRC_FILES := \ + $(addprefix $(LATIN_DICT_TOOLKIT_TEST_SRC_DIR)/, $(LATIN_IME_DICT_TOOLKIT_TEST_FILES)) +LOCAL_STATIC_LIBRARIES += liblatinime_dicttoolkit_host_static_for_unittests +include $(BUILD_HOST_NATIVE_TEST) + +include $(LOCAL_PATH)/CleanupNativeFileList.mk + +#################### Clean up the tmp vars +LATINIME_HOST_OSNAME := +LATIN_IME_SRC_DIR := +LATIN_IME_TEST_SRC_DIR := + +endif # TARGET_BUILD_APPS diff --git a/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h index ea17a31d3..13d26ba91 100644 --- a/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h +++ b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict.h @@ -20,7 +20,7 @@ #include "dict_toolkit_defines.h" #include "offdevice_intermediate_dict/offdevice_intermediate_dict_header.h" #include "offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node_array.h" -#include "dictionary/property/word_property.h" +#include "suggest/core/dictionary/property/word_property.h" #include "utils/int_array_view.h" namespace latinime { diff --git a/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node.h b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node.h index e7d7e13eb..721ccd778 100644 --- a/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node.h +++ b/native/dicttoolkit/src/offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node.h @@ -21,7 +21,7 @@ #include "dict_toolkit_defines.h" #include "offdevice_intermediate_dict/offdevice_intermediate_dict_pt_node_array.h" -#include "dictionary/property/word_property.h" +#include "suggest/core/dictionary/property/word_property.h" #include "utils/int_array_view.h" namespace latinime { diff --git a/native/dicttoolkit/tests/offdevice_intermediate_dict/offdevice_intermediate_dict_test.cpp b/native/dicttoolkit/tests/offdevice_intermediate_dict/offdevice_intermediate_dict_test.cpp index 89598de60..f2e24ab5f 100644 --- a/native/dicttoolkit/tests/offdevice_intermediate_dict/offdevice_intermediate_dict_test.cpp +++ b/native/dicttoolkit/tests/offdevice_intermediate_dict/offdevice_intermediate_dict_test.cpp @@ -20,7 +20,7 @@ #include <vector> -#include "dictionary/property/word_property.h" +#include "suggest/core/dictionary/property/word_property.h" #include "utils/int_array_view.h" namespace latinime { diff --git a/native/jni/Android.mk b/native/jni/Android.mk new file mode 100644 index 000000000..7627179c1 --- /dev/null +++ b/native/jni/Android.mk @@ -0,0 +1,98 @@ +# Copyright (C) 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. + +LOCAL_PATH := $(call my-dir) + +############ some local flags +# If you change any of those flags, you need to rebuild both libjni_latinime_common_static +# and the shared library that uses libjni_latinime_common_static. +FLAG_DBG ?= false +FLAG_DO_PROFILE ?= false + +###################################### +include $(CLEAR_VARS) + +LATIN_IME_SRC_DIR := src + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR) + +LOCAL_CFLAGS += -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-align \ + -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls \ + -Woverloaded-virtual -Wsign-promo -Wno-system-headers -Wno-deprecated-copy + +# To suppress compiler warnings for unused variables/functions used for debug features etc. +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function + +# HACK: -mstackrealign is required for x86 builds running on pre-KitKat devices to avoid crashes +# with SSE instructions. +ifeq ($(TARGET_ARCH), x86) + LOCAL_CFLAGS += -mstackrealign +endif # x86 + +include $(LOCAL_PATH)/NativeFileList.mk + +LOCAL_SRC_FILES := \ + $(LATIN_IME_JNI_SRC_FILES) \ + $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES)) + +ifeq ($(FLAG_DO_PROFILE), true) + $(warning Making profiling version of native library) + LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables +else # FLAG_DO_PROFILE +ifeq ($(FLAG_DBG), true) + $(warning Making debug version of native library) + LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline +ifeq ($(FLAG_FULL_DBG), true) + $(warning Making full debug version of native library) + LOCAL_CFLAGS += -DFLAG_FULL_DBG +endif # FLAG_FULL_DBG +endif # FLAG_DBG +endif # FLAG_DO_PROFILE + +LOCAL_MODULE := libjni_latinime_common_static +LOCAL_MODULE_TAGS := optional + +LOCAL_SDK_VERSION := 14 +LOCAL_NDK_STL_VARIANT := c++_static + +include $(BUILD_STATIC_LIBRARY) +###################################### +include $(CLEAR_VARS) + +# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library. +LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_common_static + +ifeq ($(FLAG_DO_PROFILE), true) + $(warning Making profiling version of native library) + LOCAL_LDFLAGS += -llog +else # FLAG_DO_PROFILE +ifeq ($(FLAG_DBG), true) + $(warning Making debug version of native library) + LOCAL_LDFLAGS += -llog +endif # FLAG_DBG +endif # FLAG_DO_PROFILE + +LOCAL_MODULE := libjni_latinime +LOCAL_MODULE_TAGS := optional + +LOCAL_SDK_VERSION := 14 +LOCAL_NDK_STL_VARIANT := c++_static +LOCAL_LDFLAGS += -ldl + +include $(BUILD_SHARED_LIBRARY) +#################### Clean up the tmp vars +include $(LOCAL_PATH)/CleanupNativeFileList.mk + +#################### Unit test on target environment +include $(LOCAL_PATH)/TargetUnitTests.mk diff --git a/native/jni/Application.mk b/native/jni/Application.mk new file mode 100644 index 000000000..ce095350e --- /dev/null +++ b/native/jni/Application.mk @@ -0,0 +1 @@ +APP_STL := c++_static diff --git a/native/jni/CleanupNativeFileList.mk b/native/jni/CleanupNativeFileList.mk new file mode 100644 index 000000000..eed6f1e63 --- /dev/null +++ b/native/jni/CleanupNativeFileList.mk @@ -0,0 +1,19 @@ +# 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. + +LATIN_IME_CORE_SRC_FILES := +LATIN_IME_CORE_SRC_FILES_BACKWARD_V401 := +LATIN_IME_CORE_TEST_FILES := +LATIN_IME_JNI_SRC_FILES := +LATIN_IME_SRC_DIR := diff --git a/native/jni/NativeFileList.mk b/native/jni/NativeFileList.mk new file mode 100644 index 000000000..d8b69bfd7 --- /dev/null +++ b/native/jni/NativeFileList.mk @@ -0,0 +1,146 @@ +# 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. + +LATIN_IME_JNI_SRC_FILES := \ + com_android_inputmethod_keyboard_ProximityInfo.cpp \ + com_android_inputmethod_latin_BinaryDictionary.cpp \ + com_android_inputmethod_latin_BinaryDictionaryUtils.cpp \ + com_android_inputmethod_latin_DicTraverseSession.cpp \ + jni_common.cpp + +LATIN_IME_CORE_SRC_FILES := \ + $(addprefix dictionary/header/, \ + header_policy.cpp \ + header_read_write_utils.cpp) \ + dictionary/property/ngram_context.cpp \ + dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp \ + $(addprefix dictionary/structure/pt_common/, \ + bigram/bigram_list_read_write_utils.cpp \ + dynamic_pt_gc_event_listeners.cpp \ + dynamic_pt_reading_helper.cpp \ + dynamic_pt_reading_utils.cpp \ + dynamic_pt_updating_helper.cpp \ + dynamic_pt_writing_utils.cpp \ + patricia_trie_reading_utils.cpp \ + shortcut/shortcut_list_reading_utils.cpp) \ + $(addprefix dictionary/structure/v2/, \ + patricia_trie_policy.cpp \ + ver2_patricia_trie_node_reader.cpp \ + ver2_pt_node_array_reader.cpp) \ + $(addprefix dictionary/structure/v4/, \ + ver4_dict_buffers.cpp \ + ver4_dict_constants.cpp \ + ver4_patricia_trie_node_reader.cpp \ + ver4_patricia_trie_node_writer.cpp \ + ver4_patricia_trie_policy.cpp \ + ver4_patricia_trie_reading_utils.cpp \ + ver4_patricia_trie_writing_helper.cpp \ + ver4_pt_node_array_reader.cpp) \ + $(addprefix dictionary/structure/v4/content/, \ + dynamic_language_model_probability_utils.cpp \ + language_model_dict_content.cpp \ + language_model_dict_content_global_counters.cpp \ + shortcut_dict_content.cpp \ + sparse_table_dict_content.cpp \ + terminal_position_lookup_table.cpp) \ + $(addprefix dictionary/utils/, \ + buffer_with_extendable_buffer.cpp \ + byte_array_utils.cpp \ + dict_file_writing_utils.cpp \ + file_utils.cpp \ + forgetting_curve_utils.cpp \ + format_utils.cpp \ + mmapped_buffer.cpp \ + multi_bigram_map.cpp \ + probability_utils.cpp \ + sparse_table.cpp \ + trie_map.cpp ) \ + suggest/core/suggest.cpp \ + $(addprefix suggest/core/dicnode/, \ + dic_node.cpp \ + dic_node_utils.cpp \ + dic_nodes_cache.cpp) \ + $(addprefix suggest/core/dictionary/, \ + dictionary.cpp \ + dictionary_utils.cpp \ + digraph_utils.cpp \ + error_type_utils.cpp ) \ + $(addprefix suggest/core/layout/, \ + additional_proximity_chars.cpp \ + proximity_info.cpp \ + proximity_info_params.cpp \ + proximity_info_state.cpp \ + proximity_info_state_utils.cpp) \ + suggest/core/policy/weighting.cpp \ + suggest/core/session/dic_traverse_session.cpp \ + $(addprefix suggest/core/result/, \ + suggestion_results.cpp \ + suggestions_output_utils.cpp) \ + suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp \ + $(addprefix suggest/policyimpl/typing/, \ + scoring_params.cpp \ + typing_scoring.cpp \ + typing_suggest_policy.cpp \ + typing_traversal.cpp \ + typing_weighting.cpp) \ + $(addprefix utils/, \ + autocorrection_threshold_utils.cpp \ + char_utils.cpp \ + jni_data_utils.cpp \ + log_utils.cpp \ + time_keeper.cpp) + +LATIN_IME_CORE_SRC_FILES_BACKWARD_V402 := \ + $(addprefix dictionary/structure/backward/v402/, \ + ver4_dict_buffers.cpp \ + ver4_dict_constants.cpp \ + ver4_patricia_trie_node_reader.cpp \ + ver4_patricia_trie_node_writer.cpp \ + ver4_patricia_trie_policy.cpp \ + ver4_patricia_trie_reading_utils.cpp \ + ver4_patricia_trie_writing_helper.cpp \ + ver4_pt_node_array_reader.cpp) \ + $(addprefix dictionary/structure/backward/v402/content/, \ + bigram_dict_content.cpp \ + probability_dict_content.cpp \ + shortcut_dict_content.cpp \ + sparse_table_dict_content.cpp \ + terminal_position_lookup_table.cpp) \ + $(addprefix dictionary/structure/backward/v402/bigram/, \ + ver4_bigram_list_policy.cpp) + +LATIN_IME_CORE_SRC_FILES += $(LATIN_IME_CORE_SRC_FILES_BACKWARD_V402) + +LATIN_IME_CORE_TEST_FILES := \ + defines_test.cpp \ + dictionary/header/header_read_write_utils_test.cpp \ + dictionary/structure/v4/content/language_model_dict_content_test.cpp \ + dictionary/structure/v4/content/language_model_dict_content_global_counters_test.cpp \ + dictionary/structure/v4/content/probability_entry_test.cpp \ + dictionary/structure/v4/content/terminal_position_lookup_table_test.cpp \ + dictionary/utils/bloom_filter_test.cpp \ + dictionary/utils/buffer_with_extendable_buffer_test.cpp \ + dictionary/utils/byte_array_utils_test.cpp \ + dictionary/utils/format_utils_test.cpp \ + dictionary/utils/probability_utils_test.cpp \ + dictionary/utils/sparse_table_test.cpp \ + dictionary/utils/trie_map_test.cpp \ + suggest/core/dicnode/dic_node_pool_test.cpp \ + suggest/core/layout/geometry_utils_test.cpp \ + suggest/core/layout/normal_distribution_2d_test.cpp \ + suggest/policyimpl/utils/damerau_levenshtein_edit_distance_policy_test.cpp \ + utils/autocorrection_threshold_utils_test.cpp \ + utils/char_utils_test.cpp \ + utils/int_array_view_test.cpp \ + utils/time_keeper_test.cpp diff --git a/native/jni/TargetUnitTests.mk b/native/jni/TargetUnitTests.mk new file mode 100644 index 000000000..32aada057 --- /dev/null +++ b/native/jni/TargetUnitTests.mk @@ -0,0 +1,50 @@ +# Copyright (C) 2014 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) + +include $(LOCAL_PATH)/NativeFileList.mk + +#################### Target library for unit test +LATIN_IME_SRC_DIR := src +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wall -Werror +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR) +LOCAL_MODULE := liblatinime_target_static_for_unittests +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_SRC_FILES)) +LOCAL_SDK_VERSION := 14 +LOCAL_NDK_STL_VARIANT := c++_static +include $(BUILD_STATIC_LIBRARY) + +#################### Target native tests +include $(CLEAR_VARS) +LATIN_IME_TEST_SRC_DIR := tests +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wall -Werror +LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR) +LOCAL_MODULE := liblatinime_target_unittests +LOCAL_MODULE_TAGS := tests +LOCAL_SRC_FILES := \ + $(addprefix $(LATIN_IME_TEST_SRC_DIR)/, $(LATIN_IME_CORE_TEST_FILES)) +LOCAL_STATIC_LIBRARIES += liblatinime_target_static_for_unittests +LOCAL_SDK_VERSION := 14 +LOCAL_NDK_STL_VARIANT := c++_static +include $(BUILD_NATIVE_TEST) + +#################### Clean up the tmp vars +LATIN_IME_SRC_DIR := +LATIN_IME_TEST_SRC_DIR := +include $(LOCAL_PATH)/CleanupNativeFileList.mk |