chromium/chromeos/ash/services/assistant/BUILD.gn

# Copyright 2018 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("//chromeos/ash/components/assistant/assistant.gni")

assert(is_chromeos_ash)

component("lib") {
  output_name = "assistant_service"

  friend = [
    ":tests",
    ":test_support",
  ]

  defines = [ "IS_ASSISTANT_SERVICE_IMPL" ]

  sources = [
    "assistant_host.cc",
    "assistant_host.h",
    "assistant_interaction_logger.cc",
    "assistant_interaction_logger.h",
    "assistant_manager_service.cc",
    "assistant_manager_service.h",
    "assistant_manager_service_impl.cc",
    "assistant_manager_service_impl.h",
    "assistant_settings_impl.cc",
    "assistant_settings_impl.h",
    "device_settings_host.cc",
    "device_settings_host.h",
    "libassistant_service_host.h",
    "libassistant_service_host_impl.cc",
    "libassistant_service_host_impl.h",
    "media_host.cc",
    "media_host.h",
    "media_session/assistant_media_session.cc",
    "media_session/assistant_media_session.h",
    "platform/audio_devices.cc",
    "platform/audio_devices.h",
    "platform/audio_input_host.h",
    "platform/audio_input_host_impl.cc",
    "platform/audio_input_host_impl.h",
    "platform/audio_output_delegate_impl.cc",
    "platform/audio_output_delegate_impl.h",
    "platform/platform_delegate_impl.cc",
    "platform/platform_delegate_impl.h",
    "service.cc",
    "service.h",
    "service_context.h",
    "timer_host.cc",
    "timer_host.h",
  ]

  deps = [
    "//ash/constants",
    "//base",
    "//chromeos/ash/components/assistant:buildflags",
    "//chromeos/ash/components/audio",
    "//chromeos/ash/components/dbus",
    "//chromeos/ash/services/assistant/public/proto",
    "//chromeos/ash/services/libassistant/public/cpp:loader",
    "//chromeos/ash/services/libassistant/public/mojom",
    "//chromeos/dbus/power",
    "//chromeos/dbus/power:power_manager_proto",
    "//chromeos/strings",
    "//chromeos/version",
    "//components/account_id",
    "//components/prefs",
    "//components/signin/public/identity_manager",
    "//components/user_manager",
    "//media/mojo/mojom",
    "//services/media_session/public/cpp",
    "//ui/accessibility:ax_assistant",
  ]

  if (enable_cros_libassistant) {
    deps += [
      "//chromeos/ash/services/assistant/public/cpp",
      "//chromeos/ash/services/libassistant",
      "//chromeos/ash/services/libassistant:constants",
      "//chromeos/ash/services/libassistant:loader",
    ]
  } else {
    sources +=
        [ "//chromeos/ash/services/assistant/libassistant_loader_stub.cc" ]
  }

  public_deps = [
    "//ash/public/cpp:cpp",
    "//chromeos/ash/services/assistant/public/cpp",
    "//chromeos/ash/services/assistant/public/mojom",
    "//chromeos/services/assistant/public/shared",
    "//mojo/public/cpp/bindings",
    "//services/audio/public/cpp",
  ]
}

source_set("tests") {
  testonly = true
  deps = [
    ":lib",
    ":test_support",
    "//ash/constants",
    "//ash/public/cpp/assistant/test_support",
    "//base",
    "//base/test:test_support",
    "//chromeos/ash/components/assistant:buildflags",
    "//chromeos/ash/components/assistant/test_support",
    "//chromeos/ash/components/audio",
    "//chromeos/ash/components/dbus:test_support",
    "//chromeos/ash/components/dbus/audio",
    "//chromeos/ash/services/assistant/public/cpp",
    "//chromeos/ash/services/assistant/public/mojom",
    "//chromeos/ash/services/libassistant/public/mojom",
    "//chromeos/dbus/power",
    "//components/prefs:test_support",
    "//components/signin/public/identity_manager",
    "//components/signin/public/identity_manager:test_support",
    "//mojo/public/cpp/bindings",
    "//services/device/public/mojom",
    "//services/media_session/public/cpp/test:test_support",
    "//services/media_session/public/mojom",
    "//services/network:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]

  sources = [
    "assistant_manager_service_impl_unittest.cc",
    "media_host_unittest.cc",
    "media_session/assistant_media_session_unittest.cc",
    "platform/audio_devices_unittest.cc",
    "platform/audio_input_host_unittest.cc",
    "service_unittest.cc",
    "test_support/fake_service_context.cc",
    "test_support/fake_service_context.h",
    "test_support/scoped_device_actions.cc",
    "test_support/scoped_device_actions.h",
  ]

  if (enable_cros_libassistant) {
    deps += [ "//chromeos/assistant/internal:tests" ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "test_support/fake_assistant_manager_service_impl.cc",
    "test_support/fake_assistant_manager_service_impl.h",
    "test_support/fake_assistant_settings_impl.cc",
    "test_support/fake_assistant_settings_impl.h",
    "test_support/fake_libassistant_service.cc",
    "test_support/fake_libassistant_service.h",
    "test_support/fake_service_controller.cc",
    "test_support/fake_service_controller.h",
    "test_support/fully_initialized_assistant_state.cc",
    "test_support/fully_initialized_assistant_state.h",
    "test_support/libassistant_media_controller_mock.cc",
    "test_support/libassistant_media_controller_mock.h",
    "test_support/mock_assistant.cc",
    "test_support/mock_assistant.h",
    "test_support/mock_assistant_interaction_subscriber.cc",
    "test_support/mock_assistant_interaction_subscriber.h",
    "test_support/scoped_assistant_browser_delegate.cc",
    "test_support/scoped_assistant_browser_delegate.h",
  ]
  deps = [
    ":lib",
    "//base",
    "//chromeos/ash/components/assistant:buildflags",
    "//chromeos/ash/services/assistant/public/cpp",
    "//chromeos/ash/services/assistant/public/mojom",
    "//chromeos/ash/services/assistant/public/proto",
    "//chromeos/ash/services/libassistant/public/mojom",
    "//chromeos/services/assistant/public/shared",
    "//mojo/public/cpp/bindings",
    "//testing/gmock",
    "//testing/gtest",
  ]
}