chromium/components/soda/BUILD.gn

# Copyright 2020 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/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//components/soda/buildflags.gni")

assert(!is_android)

buildflag_header("buildflags") {
  header = "buildflags.h"
  flags = [ "ENABLE_SODA_INTEGRATION_TESTS=$enable_soda_integration_tests" ]
}

component("soda") {
  sources = [
    "soda_features.cc",
    "soda_features.h",
    "soda_installer.cc",
    "soda_installer.h",
  ]

  defines = [ "IS_SODA_INSTALLER_IMPL" ]

  deps = [
    ":constants",
    "//base",
    "//build:chromeos_buildflags",
    "//components/live_caption:constants",
    "//components/prefs",
    "//media",
  ]

  if (is_chromeos_ash) {
    sources += [
      "soda_installer_impl_chromeos.cc",
      "soda_installer_impl_chromeos.h",
    ]

    deps += [
      "//ash/constants",
      "//chromeos/ash/components/dbus/dlcservice",
      "//chromeos/ash/components/dbus/dlcservice:dlcservice_proto",
      "//ui/base",
    ]
  }

  if (is_chromeos_lacros) {
    deps += [ "//chromeos/startup:startup" ]
  }
}

source_set("constants") {
  sources = [
    "constants.cc",
    "constants.h",
    "pref_names.cc",
    "pref_names.h",
  ]

  deps = [
    "//base",
    "//components/component_updater:component_updater_paths",
    "//components/crx_file",
    "//components/strings/",
    "//media",
    "//ui/base",
  ]
}

source_set("utils") {
  sources = [
    "soda_util.cc",
    "soda_util.h",
  ]

  deps = [
    ":constants",
    ":soda",
    "//base",
    "//media",
    "//ui/base",
  ]

  if (is_chromeos_ash) {
    deps += [ "//ash/constants:constants" ]
  }

  if (is_chromeos_lacros) {
    deps += [ "//chromeos/startup:startup" ]
  }
}

source_set("unit_tests") {
  testonly = true
  if (is_chromeos_ash) {
    sources = [ "soda_installer_impl_chromeos_unittest.cc" ]

    deps = [
      ":constants",
      ":soda",
      "//ash/constants",
      "//chromeos/ash/components/dbus/dlcservice",
      "//components/live_caption:constants",
      "//components/prefs:test_support",
      "//content/test:test_support",
      "//testing/gmock",
      "//testing/gtest",
    ]
  }
}