Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / libaddressinput / BUILD.gn
blob1307c7163699f581d7f275f0c205ab18df73e0ce
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//testing/test.gni")
6 import("//tools/grit/grit_rule.gni")
8 libaddressinput_util_files = [
9   "src/cpp/src/address_data.cc",
10   "src/cpp/src/address_field.cc",
11   "src/cpp/src/address_field_util.cc",
12   "src/cpp/src/address_formatter.cc",
13   "src/cpp/src/address_metadata.cc",
14   "src/cpp/src/address_ui.cc",
15   "src/cpp/src/format_element.cc",
16   "src/cpp/src/language.cc",
17   "src/cpp/src/localization.cc",
18   "src/cpp/src/lookup_key.cc",
19   "src/cpp/src/region_data_constants.cc",
20   "src/cpp/src/rule.cc",
21   "src/cpp/src/util/cctype_tolower_equal.cc",
22   "src/cpp/src/util/json.cc",
23   "src/cpp/src/util/string_split.cc",
24   "src/cpp/src/util/string_util.cc",
27 config("no-newline-eof-warning") {
28   if (is_clang) {
29     cflags = [ "-Wno-newline-eof" ]
30   }
33 # GYP version: third_party/libaddressinput/libaddressinput.gyp:libaddressinput_strings
34 grit("strings") {
35   source = "//chrome/app/address_input_strings.grd"
36   outputs = [
37     "messages.h",
38     "en_messages.cc",
39     "address_input_strings_am.pak",
40     "address_input_strings_ar.pak",
41     "address_input_strings_bg.pak",
42     "address_input_strings_bn.pak",
43     "address_input_strings_ca.pak",
44     "address_input_strings_cs.pak",
45     "address_input_strings_da.pak",
46     "address_input_strings_de.pak",
47     "address_input_strings_el.pak",
48     "address_input_strings_en-GB.pak",
49     "address_input_strings_en-US.pak",
50     "address_input_strings_es.pak",
51     "address_input_strings_es-419.pak",
52     "address_input_strings_et.pak",
53     "address_input_strings_fa.pak",
54     "address_input_strings_fake-bidi.pak",
55     "address_input_strings_fi.pak",
56     "address_input_strings_fil.pak",
57     "address_input_strings_fr.pak",
58     "address_input_strings_gu.pak",
59     "address_input_strings_he.pak",
60     "address_input_strings_hi.pak",
61     "address_input_strings_hr.pak",
62     "address_input_strings_hu.pak",
63     "address_input_strings_id.pak",
64     "address_input_strings_it.pak",
65     "address_input_strings_ja.pak",
66     "address_input_strings_kn.pak",
67     "address_input_strings_ko.pak",
68     "address_input_strings_lt.pak",
69     "address_input_strings_lv.pak",
70     "address_input_strings_ml.pak",
71     "address_input_strings_mr.pak",
72     "address_input_strings_ms.pak",
73     "address_input_strings_nl.pak",
74     "address_input_strings_nb.pak",
75     "address_input_strings_pl.pak",
76     "address_input_strings_pt-BR.pak",
77     "address_input_strings_pt-PT.pak",
78     "address_input_strings_ro.pak",
79     "address_input_strings_ru.pak",
80     "address_input_strings_sk.pak",
81     "address_input_strings_sl.pak",
82     "address_input_strings_sr.pak",
83     "address_input_strings_sv.pak",
84     "address_input_strings_sw.pak",
85     "address_input_strings_ta.pak",
86     "address_input_strings_te.pak",
87     "address_input_strings_th.pak",
88     "address_input_strings_tr.pak",
89     "address_input_strings_uk.pak",
90     "address_input_strings_vi.pak",
91     "address_input_strings_zh-CN.pak",
92     "address_input_strings_zh-TW.pak",
93   ]
95   configs = [ ":no-newline-eof-warning" ]
98 config("libaddressinput_config") {
99   defines = [
100     "I18N_ADDRESSINPUT_USE_BASICTYPES_OVERRIDE=1",
101     "I18N_ADDRESS_VALIDATION_DATA_URL=\"https://i18napis.appspot.com/ssl-aggregate-address/\"",
102   ]
103   include_dirs = [
104     "src/cpp/include",
105     "chromium/override",
106   ]
109 # This target provides basic functionality which is cooked into the build.
110 # GYP version: third_party/libaddressinput/libaddressinput.gyp:libaddressinput_util
111 static_library("util") {
112   sources = libaddressinput_util_files
113   sources += [
114     "chromium/addressinput_util.cc",
115     "chromium/json.cc",
116   ]
117   sources -= [ "src/cpp/src/util/json.cc" ]
119   configs -= [ "//build/config/compiler:chromium_code" ]
120   configs += [
121     ":no-newline-eof-warning",
122     "//build/config/compiler:no_chromium_code",
123   ]
125   public_configs = [ ":libaddressinput_config" ]
127   include_dirs = [ "$root_gen_dir/third_party/libaddressinput" ]
129   deps = [
130     ":strings",
131     "//base",
132     "//base:i18n",
133     "//third_party/icu",
134     "//third_party/re2",
135   ]
138 if (!is_android) {
139   # The list of files in libaddressinput.gypi.
140   gypi_values = exec_script("//build/gypi_to_gn.py",
141                             [ rebase_path("src/cpp/libaddressinput.gypi") ],
142                             "scope",
143                             [ "src/cpp/libaddressinput.gypi" ])
145   # This target provides more complicated functionality like pinging servers
146   # for validation rules.
147   # GYP version: third_party/libaddressinput/libaddressinput.gyp:libaddressinput
148   static_library("libaddressinput") {
149     sources = rebase_path(gypi_values.libaddressinput_files, ".", "src/cpp")
150     sources += [
151       "chromium/chrome_address_validator.cc",
152       "chromium/chrome_metadata_source.cc",
153       "chromium/chrome_storage_impl.cc",
154       "chromium/fallback_data_store.cc",
155       "chromium/input_suggester.cc",
156       "chromium/string_compare.cc",
157       "chromium/trie.cc",
158     ]
159     sources -= libaddressinput_util_files
160     sources -= [ "src/cpp/src/util/string_compare.cc" ]
162     configs -= [ "//build/config/compiler:chromium_code" ]
163     configs += [ "//build/config/compiler:no_chromium_code" ]
165     public_configs = [ ":libaddressinput_config" ]
167     deps = [
168       ":strings",
169       ":util",
170       "//base",
171       "//base:i18n",
172       "//third_party/icu",
173       "//third_party/re2",
174     ]
175   }
177   test("libaddressinput_unittests") {
178     sources =
179         rebase_path(gypi_values.libaddressinput_test_files, ".", "src/cpp")
180     sources += [
181       "chromium/addressinput_util_unittest.cc",
182       "chromium/chrome_address_validator_unittest.cc",
183       "chromium/chrome_metadata_source_unittest.cc",
184       "chromium/chrome_storage_impl_unittest.cc",
185       "chromium/fallback_data_store_unittest.cc",
186       "chromium/storage_test_runner.cc",
187       "chromium/string_compare_unittest.cc",
188       "chromium/trie_unittest.cc",
189     ]
191     configs -= [ "//build/config/compiler:chromium_code" ]
192     configs += [ "//build/config/compiler:no_chromium_code" ]
194     defines = [ "TEST_DATA_DIR=\"third_party/libaddressinput/src/testdata\"" ]
196     include_dirs = [ "src/cpp/src" ]
198     deps = [
199       ":libaddressinput",
200       ":strings",
201       "//base:prefs",
202       "//base/test:run_all_unittests",
203       "//net:test_support",
204       "//testing/gtest",
205     ]
206   }