chromium/components/language/content/browser/ulp_language_code_locator/BUILD.gn

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/compiler/compiler.gni")
import("//build/config/python.gni")
import("//testing/test.gni")

action("ulp_serialized_to_static_c") {
  script = "ulp_serialized_to_static_c.py"
  inputs = [
    "geolanguage-data_rank0.bin",
    "geolanguage-data_rank1.bin",
    "geolanguage-data_rank2.bin",
  ]
  sources = [ "ulp_language_code_locator_helper.h.tmpl" ]
  outputs = [ "$target_gen_dir/ulp_language_code_locator_helper.h" ]

  args = [
    "--data",
    rebase_path(inputs[0], root_build_dir),
    rebase_path(inputs[1], root_build_dir),
    rebase_path(inputs[2], root_build_dir),
    "--template",
    rebase_path(sources[0], root_build_dir),
    "--output",
    rebase_path(outputs[0], root_build_dir),
  ]
}

static_library("s2langquadtree") {
  sources = [
    "s2langquadtree.cc",
    "s2langquadtree.h",
  ]
  deps = [
    "//base",
    "//third_party/s2cellid",
  ]
}

source_set("ulp_language_code_locator") {
  sources = [
              "ulp_language_code_locator.h",
              "ulp_language_code_locator.cc",
            ] + get_target_outputs(":ulp_serialized_to_static_c")
  deps = [
    ":s2langquadtree",
    ":ulp_serialized_to_static_c",
    "//base",
    "//components/language/content/browser:language_code_locator",
    "//components/prefs:prefs",
    "//third_party/s2cellid",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "s2langquadtree_datatest.cc",
    "s2langquadtree_unittest.cc",
    "ulp_language_code_locator_unittest.cc",
  ]
  deps = [
    ":s2langquadtree",
    ":ulp_language_code_locator",
    "//base",
    "//base/test:test_support",
    "//components/prefs:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/s2cellid",
  ]
}