chromium/third_party/inspector_protocol/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.

component("crdtp") {
  sources = [
    "crdtp/cbor.cc",
    "crdtp/cbor.h",
    "crdtp/chromium/protocol_traits.cc",
    "crdtp/chromium/protocol_traits.h",
    "crdtp/dispatch.cc",
    "crdtp/dispatch.h",
    "crdtp/error_support.cc",
    "crdtp/error_support.h",
    "crdtp/export.h",
    "crdtp/find_by_first.h",
    "crdtp/frontend_channel.h",
    "crdtp/json.cc",
    "crdtp/json.h",
    "crdtp/parser_handler.h",
    "crdtp/protocol_core.cc",
    "crdtp/protocol_core.h",
    "crdtp/serializable.cc",
    "crdtp/serializable.h",
    "crdtp/span.cc",
    "crdtp/span.h",
    "crdtp/status.cc",
    "crdtp/status.h",
  ]

  defines = [ "CRDTP_IMPLEMENTATION" ]

  # Disable max speed optimizations for size-sensitive platforms.
  if (!is_debug && !is_fuchsia) {
    configs -= [ "//build/config/compiler:default_optimization" ]
    configs += [ "//build/config/compiler:optimize_max" ]
  }

  deps = [
    ":crdtp_platform",
    "//base",
  ]
}

# A small adapter library which only :crdtp may depend on.
source_set("crdtp_platform") {
  visibility = [ ":crdtp" ]
  sources = [
    "crdtp/chromium/json_platform_chromium.cc",
    "crdtp/json_platform.h",
  ]
  deps = [ "//base" ]
}

# These tests are linked into //content/test:content_unittests.
source_set("crdtp_test") {
  testonly = true
  sources = [
    "crdtp/cbor_test.cc",
    "crdtp/chromium/protocol_traits_test.cc",
    "crdtp/dispatch_test.cc",
    "crdtp/error_support_test.cc",
    "crdtp/find_by_first_test.cc",
    "crdtp/json_test.cc",
    "crdtp/maybe_test.cc",
    "crdtp/protocol_core_test.cc",
    "crdtp/serializable_test.cc",
    "crdtp/span_test.cc",
    "crdtp/status_test.cc",
    "crdtp/status_test_support.cc",
    "crdtp/status_test_support.h",
  ]
  deps = [
    ":crdtp_test_platform",
    "//base/test:test_support",
  ]
}

# A small adapter library which only :crdtp_test may depend on.
source_set("crdtp_test_platform") {
  testonly = true
  sources = [
    "crdtp/test_platform.cc",
    "crdtp/test_platform.h",
  ]
  public_deps = [
    "//base",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/inspector_protocol:crdtp",
  ]
}