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

component("cpp") {
  output_name = "service_manager_cpp"

  sources = [
    "binder_registry.h",
    "connect.h",
    "connector.cc",
    "connector.h",
    "export.h",
    "interface_binder.h",
    "interface_provider.cc",
    "interface_provider.h",
    "local_interface_provider.h",
    "service.cc",
    "service.h",
    "service_context.cc",
    "service_context.h",
    "service_context_ref.cc",
    "service_context_ref.h",
    "service_keepalive.cc",
    "service_keepalive.h",
    "service_runner.cc",
    "service_runner.h",
  ]

  public_deps = [
    ":cpp_types",
    "//base",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
    "//services/service_manager/public/mojom",
    "//services/service_manager/public/mojom:constants",
    "//url",
  ]

  defines = [ "SERVICE_MANAGER_PUBLIC_CPP_IMPL" ]
}

# A component for types which the public interfaces depend on for typemapping.
# Unlike ":cpp" above, this cannot itself depend on the main public interfaces
# target.
component("cpp_types") {
  output_name = "service_manager_cpp_types"

  sources = [
    "bind_source_info.cc",
    "bind_source_info.h",
    "identity.cc",
    "identity.h",
    "interface_provider_spec.cc",
    "interface_provider_spec.h",
    "types_export.h",
  ]

  deps = [
    "//services/service_manager/public/mojom:constants",
  ]

  defines = [ "SERVICE_MANAGER_PUBLIC_CPP_TYPES_IMPL" ]
}

static_library("service_test_support") {
  testonly = true
  sources = [
    "service_test.cc",
    "service_test.h",
  ]

  public_deps = [
    ":cpp",
    "//testing/gtest",
  ]

  deps = [
    "//base",
    "//base/test:test_support",
    "//mojo/core/embedder",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/system",
    "//services/service_manager/background:lib",
    "//services/service_manager/public/mojom",
  ]

  data_deps = []
}
