1// Copyright (C) 2013 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15filegroup {
16    name: "LATIN_IME_CORE_SRC_FILES",
17    srcs: [
18        "src/dictionary/header/header_policy.cpp",
19        "src/dictionary/header/header_read_write_utils.cpp",
20        "src/dictionary/property/ngram_context.cpp",
21        "src/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp",
22        "src/dictionary/structure/pt_common/bigram/bigram_list_read_write_utils.cpp",
23        "src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp",
24        "src/dictionary/structure/pt_common/dynamic_pt_reading_helper.cpp",
25        "src/dictionary/structure/pt_common/dynamic_pt_reading_utils.cpp",
26        "src/dictionary/structure/pt_common/dynamic_pt_updating_helper.cpp",
27        "src/dictionary/structure/pt_common/dynamic_pt_writing_utils.cpp",
28        "src/dictionary/structure/pt_common/patricia_trie_reading_utils.cpp",
29        "src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp",
30        "src/dictionary/structure/v2/patricia_trie_policy.cpp",
31        "src/dictionary/structure/v2/ver2_patricia_trie_node_reader.cpp",
32        "src/dictionary/structure/v2/ver2_pt_node_array_reader.cpp",
33        "src/dictionary/structure/v4/ver4_dict_buffers.cpp",
34        "src/dictionary/structure/v4/ver4_dict_constants.cpp",
35        "src/dictionary/structure/v4/ver4_patricia_trie_node_reader.cpp",
36        "src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp",
37        "src/dictionary/structure/v4/ver4_patricia_trie_policy.cpp",
38        "src/dictionary/structure/v4/ver4_patricia_trie_reading_utils.cpp",
39        "src/dictionary/structure/v4/ver4_patricia_trie_writing_helper.cpp",
40        "src/dictionary/structure/v4/ver4_pt_node_array_reader.cpp",
41        "src/dictionary/structure/v4/content/dynamic_language_model_probability_utils.cpp",
42        "src/dictionary/structure/v4/content/language_model_dict_content.cpp",
43        "src/dictionary/structure/v4/content/language_model_dict_content_global_counters.cpp",
44        "src/dictionary/structure/v4/content/shortcut_dict_content.cpp",
45        "src/dictionary/structure/v4/content/sparse_table_dict_content.cpp",
46        "src/dictionary/structure/v4/content/terminal_position_lookup_table.cpp",
47        "src/dictionary/utils/buffer_with_extendable_buffer.cpp",
48        "src/dictionary/utils/byte_array_utils.cpp",
49        "src/dictionary/utils/dict_file_writing_utils.cpp",
50        "src/dictionary/utils/file_utils.cpp",
51        "src/dictionary/utils/forgetting_curve_utils.cpp",
52        "src/dictionary/utils/format_utils.cpp",
53        "src/dictionary/utils/mmapped_buffer.cpp",
54        "src/dictionary/utils/multi_bigram_map.cpp",
55        "src/dictionary/utils/probability_utils.cpp",
56        "src/dictionary/utils/sparse_table.cpp",
57        "src/dictionary/utils/trie_map.cpp",
58        "src/suggest/core/suggest.cpp",
59        "src/suggest/core/dicnode/dic_node.cpp",
60        "src/suggest/core/dicnode/dic_node_utils.cpp",
61        "src/suggest/core/dicnode/dic_nodes_cache.cpp",
62        "src/suggest/core/dictionary/dictionary.cpp",
63        "src/suggest/core/dictionary/dictionary_utils.cpp",
64        "src/suggest/core/dictionary/digraph_utils.cpp",
65        "src/suggest/core/dictionary/error_type_utils.cpp",
66        "src/suggest/core/layout/additional_proximity_chars.cpp",
67        "src/suggest/core/layout/proximity_info.cpp",
68        "src/suggest/core/layout/proximity_info_params.cpp",
69        "src/suggest/core/layout/proximity_info_state.cpp",
70        "src/suggest/core/layout/proximity_info_state_utils.cpp",
71        "src/suggest/core/policy/weighting.cpp",
72        "src/suggest/core/session/dic_traverse_session.cpp",
73        "src/suggest/core/result/suggestion_results.cpp",
74        "src/suggest/core/result/suggestions_output_utils.cpp",
75        "src/suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp",
76        "src/suggest/policyimpl/typing/scoring_params.cpp",
77        "src/suggest/policyimpl/typing/typing_scoring.cpp",
78        "src/suggest/policyimpl/typing/typing_suggest_policy.cpp",
79        "src/suggest/policyimpl/typing/typing_traversal.cpp",
80        "src/suggest/policyimpl/typing/typing_weighting.cpp",
81        "src/utils/autocorrection_threshold_utils.cpp",
82        "src/utils/char_utils.cpp",
83        "src/utils/jni_data_utils.cpp",
84        "src/utils/log_utils.cpp",
85        "src/utils/time_keeper.cpp",
86
87        // BACKWARD_V402
88        "src/dictionary/structure/backward/v402/ver4_dict_buffers.cpp",
89        "src/dictionary/structure/backward/v402/ver4_dict_constants.cpp",
90        "src/dictionary/structure/backward/v402/ver4_patricia_trie_node_reader.cpp",
91        "src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp",
92        "src/dictionary/structure/backward/v402/ver4_patricia_trie_policy.cpp",
93        "src/dictionary/structure/backward/v402/ver4_patricia_trie_reading_utils.cpp",
94        "src/dictionary/structure/backward/v402/ver4_patricia_trie_writing_helper.cpp",
95        "src/dictionary/structure/backward/v402/ver4_pt_node_array_reader.cpp",
96        "src/dictionary/structure/backward/v402/content/bigram_dict_content.cpp",
97        "src/dictionary/structure/backward/v402/content/probability_dict_content.cpp",
98        "src/dictionary/structure/backward/v402/content/shortcut_dict_content.cpp",
99        "src/dictionary/structure/backward/v402/content/sparse_table_dict_content.cpp",
100        "src/dictionary/structure/backward/v402/content/terminal_position_lookup_table.cpp",
101        "src/dictionary/structure/backward/v402/bigram/ver4_bigram_list_policy.cpp",
102    ],
103}
104
105cc_library {
106    name: "libjni_latinime",
107    host_supported: true,
108    product_specific: true,
109
110    sdk_version: "14",
111    cflags: [
112        "-Werror",
113        "-Wall",
114        "-Wextra",
115        "-Weffc++",
116        "-Wformat=2",
117        "-Wcast-qual",
118        "-Wcast-align",
119        "-Wwrite-strings",
120        "-Wfloat-equal",
121        "-Wpointer-arith",
122        "-Winit-self",
123        "-Wredundant-decls",
124        "-Woverloaded-virtual",
125        "-Wsign-promo",
126        "-Wno-system-headers",
127        "-Wno-format-nonliteral",
128
129        // To suppress compiler warnings for unused variables/functions used for debug features etc.
130        "-Wno-unused-parameter",
131        "-Wno-unused-function",
132    ],
133    local_include_dirs: ["src"],
134
135    srcs: [
136        "com_android_inputmethod_keyboard_ProximityInfo.cpp",
137        "com_android_inputmethod_latin_BinaryDictionary.cpp",
138        "com_android_inputmethod_latin_BinaryDictionaryUtils.cpp",
139        "com_android_inputmethod_latin_DicTraverseSession.cpp",
140        "jni_common.cpp",
141
142        ":LATIN_IME_CORE_SRC_FILES",
143    ],
144
145    target: {
146        android_x86: {
147            // HACK: -mstackrealign is required for x86 builds running on pre-KitKat devices to avoid crashes
148            // with SSE instructions.
149            cflags: ["-mstackrealign"],
150        },
151        android: {
152            stl: "libc++_static",
153        },
154        host: {
155            cflags: ["-DHOST_TOOL"],
156        },
157    },
158}
159
160cc_library_static {
161    name: "liblatinime_static_for_unittests",
162    host_supported: true,
163
164    cflags: [
165        "-Wno-unused-parameter",
166        "-Wno-unused-function",
167        "-Wall",
168        "-Werror",
169    ],
170    local_include_dirs: ["src"],
171    sdk_version: "14",
172    stl: "libc++_static",
173
174    srcs: [":LATIN_IME_CORE_SRC_FILES"],
175}
176
177cc_test {
178    name: "liblatinime_unittests",
179    host_supported: true,
180
181    cflags: [
182        "-Wno-unused-parameter",
183        "-Wno-unused-function",
184        "-Wall",
185        "-Werror",
186    ],
187    local_include_dirs: ["src"],
188    sdk_version: "14",
189    stl: "libc++_static",
190
191    srcs: [
192        "tests/defines_test.cpp",
193        "tests/dictionary/header/header_read_write_utils_test.cpp",
194        "tests/dictionary/structure/v4/content/language_model_dict_content_test.cpp",
195        "tests/dictionary/structure/v4/content/language_model_dict_content_global_counters_test.cpp",
196        "tests/dictionary/structure/v4/content/probability_entry_test.cpp",
197        "tests/dictionary/structure/v4/content/terminal_position_lookup_table_test.cpp",
198        "tests/dictionary/utils/bloom_filter_test.cpp",
199        "tests/dictionary/utils/buffer_with_extendable_buffer_test.cpp",
200        "tests/dictionary/utils/byte_array_utils_test.cpp",
201        "tests/dictionary/utils/format_utils_test.cpp",
202        "tests/dictionary/utils/probability_utils_test.cpp",
203        "tests/dictionary/utils/sparse_table_test.cpp",
204        "tests/dictionary/utils/trie_map_test.cpp",
205        "tests/suggest/core/dicnode/dic_node_pool_test.cpp",
206        "tests/suggest/core/layout/geometry_utils_test.cpp",
207        "tests/suggest/core/layout/normal_distribution_2d_test.cpp",
208        "tests/suggest/policyimpl/utils/damerau_levenshtein_edit_distance_policy_test.cpp",
209        "tests/utils/autocorrection_threshold_utils_test.cpp",
210        "tests/utils/char_utils_test.cpp",
211        "tests/utils/int_array_view_test.cpp",
212        "tests/utils/time_keeper_test.cpp",
213    ],
214    static_libs: ["liblatinime_static_for_unittests"],
215}
216