# 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("//third_party/abseil-cpp/absl.gni")

absl_source_set("status") {
  public = [
    "status.h",
    "status_payload_printer.h",
  ]
  sources = [
    "internal/status_internal.cc",
    "internal/status_internal.h",
    "status.cc",
    "status_payload_printer.cc",
  ]
  deps = [
    "//third_party/abseil-cpp/absl/base:atomic_hook",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:no_destructor",
    "//third_party/abseil-cpp/absl/base:nullability",
    "//third_party/abseil-cpp/absl/base:raw_logging_internal",
    "//third_party/abseil-cpp/absl/base:strerror",
    "//third_party/abseil-cpp/absl/container:inlined_vector",
    "//third_party/abseil-cpp/absl/debugging:leak_check",
    "//third_party/abseil-cpp/absl/debugging:stacktrace",
    "//third_party/abseil-cpp/absl/debugging:symbolize",
    "//third_party/abseil-cpp/absl/functional:function_ref",
    "//third_party/abseil-cpp/absl/memory",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:cord",
    "//third_party/abseil-cpp/absl/strings:str_format",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/types:optional",
    "//third_party/abseil-cpp/absl/types:span",
  ]

  if (!is_win || is_clang) {
    # TODO(crbug.com/331100926): Remove once fixed in upstream absl.
    cflags_cc = [ "-Wno-deprecated-pragma" ]
  }
}

absl_test("status_test") {
  sources = [ "status_test.cc" ]
  deps = [
    ":status",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:cord",
    "//third_party/abseil-cpp/absl/strings:str_format",
  ]
}

absl_source_set("statusor") {
  public = [ "statusor.h" ]
  sources = [
    "internal/statusor_internal.h",
    "statusor.cc",
  ]
  deps = [
    ":status",
    "//third_party/abseil-cpp/absl/base",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:nullability",
    "//third_party/abseil-cpp/absl/base:raw_logging_internal",
    "//third_party/abseil-cpp/absl/meta:type_traits",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:has_ostream_operator",
    "//third_party/abseil-cpp/absl/strings:str_format",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/types:variant",
    "//third_party/abseil-cpp/absl/utility",
  ]
}

absl_test("statusor_test") {
  sources = [ "statusor_test.cc" ]
  deps = [
    ":status",
    ":status_matchers",
    ":statusor",
    "//third_party/abseil-cpp/absl/base",
    "//third_party/abseil-cpp/absl/memory",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/types:any",
    "//third_party/abseil-cpp/absl/types:variant",
    "//third_party/abseil-cpp/absl/utility",
  ]
}

absl_source_set("status_matchers") {
  testonly = true
  public = [ "status_matchers.h" ]
  sources = [
    "internal/status_matchers.cc",
    "internal/status_matchers.h",
  ]
  deps = [
    ":status",
    ":statusor",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/googletest:gmock",
    "//third_party/googletest:gtest",
  ]
}

absl_test("status_matchers_test") {
  sources = [ "status_matchers_test.cc" ]
  deps = [
    ":status",
    ":status_matchers",
    ":statusor",
    "//third_party/abseil-cpp/absl/strings",
  ]
}
