chromium/chromeos/ash/components/dbus/cicerone/BUILD.gn

# Copyright 2021 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/chromeos/ui_mode.gni")
import("//third_party/protobuf/proto_library.gni")

assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //chromeos/ash")

component("cicerone") {
  defines = [ "IS_CICERONE_IMPL" ]
  deps = [
    ":cicerone_proto",
    "//base",
    "//chromeos/dbus/common",
    "//dbus",
  ]

  sources = [
    "cicerone_client.cc",
    "cicerone_client.h",
    "fake_cicerone_client.cc",
    "fake_cicerone_client.h",
  ]
}

# This is necessary for things depending on cicerone_proto_lib to get correct includes.
static_library("cicerone_proto") {
  public_deps = [ ":cicerone_proto_lib" ]
  all_dependent_configs = [ ":apps_proto_include_config" ]
}

# cros_system_api/dbus/vm_cicerone/cicerone_service.proto imports
# cros_system_api/dbus/vm_applications/apps.proto, but we need to explicitly include
# apps.pb.h from gen/chromeos/ash/components/dbus, otherwise we get
# an incompatible version from
# build/cros_cache/chrome-sdk/symlinks/atlas+15600.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz/usr/include/vm_applications/apps.pb.h
config("apps_proto_include_config") {
  include_dirs = [ "${root_gen_dir}/chromeos/ash/components/dbus" ]
}

proto_library("cicerone_proto_lib") {
  sources = [
    "//third_party/cros_system_api/dbus/vm_cicerone/cicerone_service.proto",
  ]
  proto_deps = [ "//chromeos/ash/components/dbus:vm_applications_apps_proto" ]
  import_dirs = [ "//third_party/cros_system_api/dbus" ]
  proto_out_dir = "chromeos/ash/components/dbus/cicerone"

  # This is necessary for cicerone_service.pb.c to get correct includes:
  extra_configs = [ ":apps_proto_include_config" ]
}