# Copyright 2022 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("absl_check") {
  public = [ "absl_check.h" ]
  deps = [ "//third_party/abseil-cpp/absl/log/internal:check_impl" ]
}

absl_source_set("absl_log") {
  public = [ "absl_log.h" ]
  deps = [ "//third_party/abseil-cpp/absl/log/internal:log_impl" ]
}

absl_source_set("check") {
  public = [ "check.h" ]
  deps = [
    "//third_party/abseil-cpp/absl/log/internal:check_impl",
    "//third_party/abseil-cpp/absl/log/internal:check_op",
    "//third_party/abseil-cpp/absl/log/internal:conditions",
    "//third_party/abseil-cpp/absl/log/internal:log_message",
    "//third_party/abseil-cpp/absl/log/internal:strip",
  ]
}

absl_source_set("die_if_null") {
  sources = [ "die_if_null.cc" ]
  public = [ "die_if_null.h" ]
  deps = [
    ":log",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/strings",
  ]
}

absl_source_set("flags") {
  sources = [ "flags.cc" ]
  public = [ "flags.h" ]
  deps = [
    ":globals",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/flags:flag",
    "//third_party/abseil-cpp/absl/flags:marshalling",
    "//third_party/abseil-cpp/absl/log/internal:config",
    "//third_party/abseil-cpp/absl/log/internal:flags",
    "//third_party/abseil-cpp/absl/log/internal:vlog_config",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_source_set("globals") {
  sources = [ "globals.cc" ]
  public = [ "globals.h" ]
  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:log_severity",
    "//third_party/abseil-cpp/absl/base:raw_logging_internal",
    "//third_party/abseil-cpp/absl/hash",
    "//third_party/abseil-cpp/absl/log/internal:vlog_config",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_source_set("initialize") {
  sources = [ "initialize.cc" ]
  public = [ "initialize.h" ]
  deps = [
    ":globals",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/log/internal:globals",
    "//third_party/abseil-cpp/absl/time",
  ]
}

absl_source_set("log") {
  public = [ "log.h" ]
  deps = [
    ":vlog_is_on",
    "//third_party/abseil-cpp/absl/log/internal:log_impl",
  ]
}

absl_source_set("log_entry") {
  sources = [ "log_entry.cc" ]
  public = [ "log_entry.h" ]
  deps = [
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:config",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/time",
    "//third_party/abseil-cpp/absl/types:span",
  ]
}

absl_source_set("log_sink") {
  sources = [ "log_sink.cc" ]
  public = [ "log_sink.h" ]
  deps = [
    ":log_entry",
    "//third_party/abseil-cpp/absl/base:config",
  ]
}

absl_source_set("log_sink_registry") {
  public = [ "log_sink_registry.h" ]
  deps = [
    ":log_sink",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:nullability",
    "//third_party/abseil-cpp/absl/log/internal:log_sink_set",
  ]
}

absl_source_set("log_streamer") {
  public = [ "log_streamer.h" ]
  deps = [
    ":absl_log",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/strings:internal",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/types:optional",
    "//third_party/abseil-cpp/absl/utility",
  ]
}

absl_source_set("scoped_mock_log") {
  testonly = true
  sources = [ "scoped_mock_log.cc" ]
  public = [ "scoped_mock_log.h" ]
  deps = [
    ":log_entry",
    ":log_sink",
    ":log_sink_registry",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/base:raw_logging_internal",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/googletest:gmock",
    "//third_party/googletest:gtest",
  ]
}

absl_source_set("structured") {
  testonly = true
  public = [ "structured.h" ]
  deps = [
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:structured",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_source_set("absl_vlog_is_on") {
  public = [ "absl_vlog_is_on.h" ]
  deps = [
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:vlog_config",
    "//third_party/abseil-cpp/absl/strings",
  ]
}

absl_source_set("vlog_is_on") {
  public = [ "vlog_is_on.h" ]
  deps = [ ":absl_vlog_is_on" ]
}

absl_test("vlog_is_on_test") {
  sources = [ "vlog_is_on_test.cc" ]
  deps = [
    ":flags",
    ":globals",
    ":log",
    ":scoped_mock_log",
    ":vlog_is_on",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/flags:flag",
    "//third_party/abseil-cpp/absl/types:optional",
  ]
}

absl_test("absl_check_test") {
  sources = [ "absl_check_test.cc" ]
  if (is_ios) {
    sources = []
  }
  deps = [
    ":absl_check",
    ":check_test_impl",
  ]
}

absl_test("absl_log_basic_test") {
  sources = [ "absl_log_basic_test.cc" ]
  deps = [
    ":absl_log",
    ":log_basic_test_impl",
  ]
}

absl_test("check_test") {
  sources = [ "check_test.cc" ]
  if (is_ios) {
    sources = []
  }
  deps = [
    ":check",
    ":check_test_impl",
  ]
}

absl_source_set("check_test_impl") {
  testonly = true
  public = [ "check_test_impl.inc" ]
  visibility = [ ":*" ]
  deps = [
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/status",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/googletest:gmock",
    "//third_party/googletest:gtest",
  ]
}

absl_test("die_if_null_test") {
  sources = [ "die_if_null_test.cc" ]
  deps = [
    ":die_if_null",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
  ]
}

absl_test("flags_test") {
  sources = [ "flags_test.cc" ]
  deps = [
    ":flags",
    ":globals",
    ":log",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/flags:flag",
    "//third_party/abseil-cpp/absl/flags:reflection",
    "//third_party/abseil-cpp/absl/log/internal:flags",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/abseil-cpp/absl/strings",
  ]
}

absl_test("globals_test") {
  sources = [ "globals_test.cc" ]
  deps = [
    ":globals",
    ":log",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:globals",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
  ]
}

absl_test("log_basic_test") {
  sources = [ "log_basic_test.cc" ]
  deps = [
    ":log",
    ":log_basic_test_impl",
  ]
}

absl_source_set("log_basic_test_impl") {
  public = [ "log_basic_test_impl.inc" ]
  testonly = true
  visibility = [ ":*" ]
  deps = [
    ":globals",
    ":log_entry",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:globals",
    "//third_party/abseil-cpp/absl/log/internal:test_actions",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/googletest:gmock",
    "//third_party/googletest:gtest",
  ]
}

absl_test("log_entry_test") {
  sources = [ "log_entry_test.cc" ]
  deps = [
    ":log_entry",
    "//third_party/abseil-cpp/absl/base:config",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:append_truncated",
    "//third_party/abseil-cpp/absl/log/internal:format",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/time",
    "//third_party/abseil-cpp/absl/types:span",
  ]
}

absl_test("log_format_test") {
  sources = [ "log_format_test.cc" ]
  deps = [
    ":check",
    ":log",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:str_format",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/types:optional",
  ]
}

absl_test("log_macro_hygiene_test") {
  sources = [ "log_macro_hygiene_test.cc" ]
  deps = [
    ":log",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
  ]
}

absl_test("log_sink_test") {
  sources = [ "log_sink_test.cc" ]
  if (is_ios) {
    sources = []
  }
  deps = [
    ":log",
    ":log_sink",
    ":log_sink_registry",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:test_actions",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_test("log_streamer_test") {
  sources = [ "log_streamer_test.cc" ]
  deps = [
    ":log",
    ":log_streamer",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:test_actions",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_test("log_modifier_methods_test") {
  sources = [ "log_modifier_methods_test.cc" ]
  deps = [
    ":log",
    ":log_sink",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/log/internal:test_actions",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:string_view",
    "//third_party/abseil-cpp/absl/time",
  ]
}

absl_test("scoped_mock_log_test") {
  sources = [ "scoped_mock_log_test.cc" ]
  if (is_ios) {
    sources = []
  }
  deps = [
    ":globals",
    ":log",
    ":scoped_mock_log",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
    "//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/synchronization",
  ]
}

absl_test("stripping_test") {
  sources = [ "stripping_test.cc" ]
  deps = [
    ":check",
    ":log",
    "//third_party/abseil-cpp/absl/base:log_severity",
    "//third_party/abseil-cpp/absl/base:strerror",
    "//third_party/abseil-cpp/absl/flags:program_name",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/status",
    "//third_party/abseil-cpp/absl/strings",
    "//third_party/abseil-cpp/absl/strings:str_format",
    "//third_party/abseil-cpp/absl/strings:string_view",
  ]
}

absl_test("structured_test") {
  sources = [ "structured_test.cc" ]
  deps = [
    ":log",
    ":scoped_mock_log",
    ":structured",
    "//third_party/abseil-cpp/absl/base:core_headers",
    "//third_party/abseil-cpp/absl/log/internal:test_helpers",
    "//third_party/abseil-cpp/absl/log/internal:test_matchers",
  ]
}
