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
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "packages_inputmethods_LatinIME_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["packages_inputmethods_LatinIME_license"],
22}
23
24filegroup {
25    name: "LATIN_IME_CORE_SRC_FILES",
26    srcs: [
27        "src/dictionary/header/header_policy.cpp",
28        "src/dictionary/header/header_read_write_utils.cpp",
29        "src/dictionary/property/ngram_context.cpp",
30        "src/dictionary/structure/dictionary_structure_with_buffer_policy_factory.cpp",
31        "src/dictionary/structure/pt_common/bigram/bigram_list_read_write_utils.cpp",
32        "src/dictionary/structure/pt_common/dynamic_pt_gc_event_listeners.cpp",
33        "src/dictionary/structure/pt_common/dynamic_pt_reading_helper.cpp",
34        "src/dictionary/structure/pt_common/dynamic_pt_reading_utils.cpp",
35        "src/dictionary/structure/pt_common/dynamic_pt_updating_helper.cpp",
36        "src/dictionary/structure/pt_common/dynamic_pt_writing_utils.cpp",
37        "src/dictionary/structure/pt_common/patricia_trie_reading_utils.cpp",
38        "src/dictionary/structure/pt_common/shortcut/shortcut_list_reading_utils.cpp",
39        "src/dictionary/structure/v2/patricia_trie_policy.cpp",
40        "src/dictionary/structure/v2/ver2_patricia_trie_node_reader.cpp",
41        "src/dictionary/structure/v2/ver2_pt_node_array_reader.cpp",
42        "src/dictionary/structure/v4/ver4_dict_buffers.cpp",
43        "src/dictionary/structure/v4/ver4_dict_constants.cpp",
44        "src/dictionary/structure/v4/ver4_patricia_trie_node_reader.cpp",
45        "src/dictionary/structure/v4/ver4_patricia_trie_node_writer.cpp",
46        "src/dictionary/structure/v4/ver4_patricia_trie_policy.cpp",
47        "src/dictionary/structure/v4/ver4_patricia_trie_reading_utils.cpp",
48        "src/dictionary/structure/v4/ver4_patricia_trie_writing_helper.cpp",
49        "src/dictionary/structure/v4/ver4_pt_node_array_reader.cpp",
50        "src/dictionary/structure/v4/content/dynamic_language_model_probability_utils.cpp",
51        "src/dictionary/structure/v4/content/language_model_dict_content.cpp",
52        "src/dictionary/structure/v4/content/language_model_dict_content_global_counters.cpp",
53        "src/dictionary/structure/v4/content/shortcut_dict_content.cpp",
54        "src/dictionary/structure/v4/content/sparse_table_dict_content.cpp",
55        "src/dictionary/structure/v4/content/terminal_position_lookup_table.cpp",
56        "src/dictionary/utils/buffer_with_extendable_buffer.cpp",
57        "src/dictionary/utils/byte_array_utils.cpp",
58        "src/dictionary/utils/dict_file_writing_utils.cpp",
59        "src/dictionary/utils/file_utils.cpp",
60        "src/dictionary/utils/forgetting_curve_utils.cpp",
61        "src/dictionary/utils/format_utils.cpp",
62        "src/dictionary/utils/mmapped_buffer.cpp",
63        "src/dictionary/utils/multi_bigram_map.cpp",
64        "src/dictionary/utils/probability_utils.cpp",
65        "src/dictionary/utils/sparse_table.cpp",
66        "src/dictionary/utils/trie_map.cpp",
67        "src/suggest/core/suggest.cpp",
68        "src/suggest/core/dicnode/dic_node.cpp",
69        "src/suggest/core/dicnode/dic_node_utils.cpp",
70        "src/suggest/core/dicnode/dic_nodes_cache.cpp",
71        "src/suggest/core/dictionary/dictionary.cpp",
72        "src/suggest/core/dictionary/dictionary_utils.cpp",
73        "src/suggest/core/dictionary/digraph_utils.cpp",
74        "src/suggest/core/dictionary/error_type_utils.cpp",
75        "src/suggest/core/layout/additional_proximity_chars.cpp",
76        "src/suggest/core/layout/proximity_info.cpp",
77        "src/suggest/core/layout/proximity_info_params.cpp",
78        "src/suggest/core/layout/proximity_info_state.cpp",
79        "src/suggest/core/layout/proximity_info_state_utils.cpp",
80        "src/suggest/core/policy/weighting.cpp",
81        "src/suggest/core/session/dic_traverse_session.cpp",
82        "src/suggest/core/result/suggestion_results.cpp",
83        "src/suggest/core/result/suggestions_output_utils.cpp",
84        "src/suggest/policyimpl/gesture/gesture_suggest_policy_factory.cpp",
85        "src/suggest/policyimpl/typing/scoring_params.cpp",
86        "src/suggest/policyimpl/typing/typing_scoring.cpp",
87        "src/suggest/policyimpl/typing/typing_suggest_policy.cpp",
88        "src/suggest/policyimpl/typing/typing_traversal.cpp",
89        "src/suggest/policyimpl/typing/typing_weighting.cpp",
90        "src/utils/autocorrection_threshold_utils.cpp",
91        "src/utils/char_utils.cpp",
92        "src/utils/jni_data_utils.cpp",
93        "src/utils/log_utils.cpp",
94        "src/utils/time_keeper.cpp",
95
96        // BACKWARD_V402
97        "src/dictionary/structure/backward/v402/ver4_dict_buffers.cpp",
98        "src/dictionary/structure/backward/v402/ver4_dict_constants.cpp",
99        "src/dictionary/structure/backward/v402/ver4_patricia_trie_node_reader.cpp",
100        "src/dictionary/structure/backward/v402/ver4_patricia_trie_node_writer.cpp",
101        "src/dictionary/structure/backward/v402/ver4_patricia_trie_policy.cpp",
102        "src/dictionary/structure/backward/v402/ver4_patricia_trie_reading_utils.cpp",
103        "src/dictionary/structure/backward/v402/ver4_patricia_trie_writing_helper.cpp",
104        "src/dictionary/structure/backward/v402/ver4_pt_node_array_reader.cpp",
105        "src/dictionary/structure/backward/v402/content/bigram_dict_content.cpp",
106        "src/dictionary/structure/backward/v402/content/probability_dict_content.cpp",
107        "src/dictionary/structure/backward/v402/content/shortcut_dict_content.cpp",
108        "src/dictionary/structure/backward/v402/content/sparse_table_dict_content.cpp",
109        "src/dictionary/structure/backward/v402/content/terminal_position_lookup_table.cpp",
110        "src/dictionary/structure/backward/v402/bigram/ver4_bigram_list_policy.cpp",
111    ],
112}
113
114cc_library {
115    name: "libjni_latinime",
116    host_supported: true,
117    product_specific: true,
118
119    sdk_version: "14",
120    cflags: [
121        "-Werror",
122        "-Wall",
123        "-Wextra",
124        "-Weffc++",
125        "-Wformat=2",
126        "-Wcast-qual",
127        "-Wcast-align",
128        "-Wwrite-strings",
129        "-Wfloat-equal",
130        "-Wpointer-arith",
131        "-Winit-self",
132        "-Wredundant-decls",
133        "-Woverloaded-virtual",
134        "-Wsign-promo",
135        "-Wno-system-headers",
136        "-Wno-format-nonliteral",
137
138        // To suppress compiler warnings for unused variables/functions used for debug features etc.
139        "-Wno-unused-parameter",
140        "-Wno-unused-function",
141    ],
142    header_libs: ["jni_headers"],
143    local_include_dirs: ["src"],
144
145    srcs: [
146        "com_android_inputmethod_keyboard_ProximityInfo.cpp",
147        "com_android_inputmethod_latin_BinaryDictionary.cpp",
148        "com_android_inputmethod_latin_BinaryDictionaryUtils.cpp",
149        "com_android_inputmethod_latin_DicTraverseSession.cpp",
150        "jni_common.cpp",
151
152        ":LATIN_IME_CORE_SRC_FILES",
153    ],
154
155    target: {
156        android_x86: {
157            // HACK: -mstackrealign is required for x86 builds running on pre-KitKat devices to avoid crashes
158            // with SSE instructions.
159            cflags: ["-mstackrealign"],
160        },
161        android: {
162            stl: "libc++_static",
163        },
164        host: {
165            cflags: ["-DHOST_TOOL"],
166        },
167    },
168}
169
170cc_library_static {
171    name: "liblatinime_static_for_unittests",
172    host_supported: true,
173
174    cflags: [
175        "-Wno-unused-parameter",
176        "-Wno-unused-function",
177        "-Wall",
178        "-Werror",
179    ],
180    header_libs: ["jni_headers"],
181    local_include_dirs: ["src"],
182    sdk_version: "14",
183    stl: "libc++_static",
184
185    srcs: [":LATIN_IME_CORE_SRC_FILES"],
186}
187
188cc_test {
189    name: "liblatinime_unittests",
190    host_supported: true,
191    test_options: {
192        unit_test: true,
193    },
194    cflags: [
195        "-Wno-unused-parameter",
196        "-Wno-unused-function",
197        "-Wall",
198        "-Werror",
199    ],
200    local_include_dirs: ["src"],
201    sdk_version: "14",
202    stl: "libc++_static",
203
204    srcs: [
205        "tests/defines_test.cpp",
206        "tests/dictionary/header/header_read_write_utils_test.cpp",
207        "tests/dictionary/structure/v4/content/language_model_dict_content_test.cpp",
208        "tests/dictionary/structure/v4/content/language_model_dict_content_global_counters_test.cpp",
209        "tests/dictionary/structure/v4/content/probability_entry_test.cpp",
210        "tests/dictionary/structure/v4/content/terminal_position_lookup_table_test.cpp",
211        "tests/dictionary/utils/bloom_filter_test.cpp",
212        "tests/dictionary/utils/buffer_with_extendable_buffer_test.cpp",
213        "tests/dictionary/utils/byte_array_utils_test.cpp",
214        "tests/dictionary/utils/format_utils_test.cpp",
215        "tests/dictionary/utils/probability_utils_test.cpp",
216        "tests/dictionary/utils/sparse_table_test.cpp",
217        "tests/dictionary/utils/trie_map_test.cpp",
218        "tests/suggest/core/dicnode/dic_node_pool_test.cpp",
219        "tests/suggest/core/layout/geometry_utils_test.cpp",
220        "tests/suggest/core/layout/normal_distribution_2d_test.cpp",
221        "tests/suggest/policyimpl/utils/damerau_levenshtein_edit_distance_policy_test.cpp",
222        "tests/utils/autocorrection_threshold_utils_test.cpp",
223        "tests/utils/char_utils_test.cpp",
224        "tests/utils/int_array_view_test.cpp",
225        "tests/utils/time_keeper_test.cpp",
226    ],
227    static_libs: ["liblatinime_static_for_unittests"],
228}
229