chromium/services/service_manager/public/cpp/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("//mojo/public/tools/bindings/mojom.gni")

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

  sources = [
    "binder_registry.h",
    "connect.h",
    "connector.cc",
    "connector.h",
    "constants.cc",
    "constants.h",
    "export.h",
    "interface_binder.h",
    "interface_provider.cc",
    "interface_provider.h",
    "local_interface_provider.h",
    "manifest.cc",
    "manifest.h",
    "manifest_builder.cc",
    "manifest_builder.h",
    "service.cc",
    "service.h",
    "service_context_ref.h",
    "service_keepalive.cc",
    "service_keepalive.h",
    "service_receiver.cc",
    "service_receiver.h",
    "standalone_connector_impl.cc",
    "standalone_connector_impl.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  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",
  ]

  deps = [ "//services/tracing/public/cpp:traced_process" ]

  defines = [
    "IS_SERVICE_MANAGER_CPP_IMPL",

    # TODO: Use COMPONENT_EXPORT everywhere here and remove this.
    "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",
    "service_filter.cc",
    "service_filter.h",
    "types_export.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

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

  defines = [
    "IS_SERVICE_MANAGER_CPP_TYPES_IMPL",

    # TODO: Use COMPONENT_EXPORT everywhere and remove this.
    "SERVICE_MANAGER_PUBLIC_CPP_TYPES_IMPL",
  ]
}

component("mojom_traits") {
  output_name = "service_manager_mojom_traits"
  sources = [
    "identity_mojom_traits.cc",
    "identity_mojom_traits.h",
    "service_filter_mojom_traits.cc",
    "service_filter_mojom_traits.h",
  ]

  public_deps = [
    ":cpp_types",
    "//mojo/public/cpp/base:shared_typemap_traits",
    "//services/service_manager/public/mojom:mojom_shared",
  ]

  defines = [ "IS_SERVICE_MANAGER_MOJOM_TRAITS_IMPL" ]
}

source_set("unittests") {
  testonly = true

  sources = [
    "manifest_unittest.cc",
    "standalone_connector_impl_unittest.cc",
  ]

  deps = [
    ":cpp",
    ":test_mojom",
    "//base",
    "//base/test:test_support",
    "//services/service_manager/public/mojom",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

mojom("test_mojom") {
  testonly = true
  sources = [ "standalone_connector_impl_unittest.test-mojom" ]
}