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