From 1a72b50ed5054cb025c0aa2a39ce2499417f2d76 Mon Sep 17 00:00:00 2001
From: wangjiezhe <wangjiezhe@gmail.com>
Date: Sun, 26 Nov 2023 13:12:20 +0800
Subject: [PATCH 09/13] systemlib: update targets for absl

---
 .../compiler/mlir/tools/kernel_gen/BUILD      |   1 +
 .../distribute/experimental/rpc/kernels/BUILD |   1 +
 third_party/absl/system.absl.debugging.BUILD  |  20 +-
 third_party/absl/system.absl.log.BUILD        | 271 ++++++++++++++++++
 third_party/absl/workspace.bzl                |   1 +
 5 files changed, 289 insertions(+), 5 deletions(-)
 create mode 100644 third_party/absl/system.absl.log.BUILD

diff --git a/tensorflow/compiler/mlir/tools/kernel_gen/BUILD b/tensorflow/compiler/mlir/tools/kernel_gen/BUILD
index 71d85d2c96e..f4a479a9daf 100644
--- a/tensorflow/compiler/mlir/tools/kernel_gen/BUILD
+++ b/tensorflow/compiler/mlir/tools/kernel_gen/BUILD
@@ -107,6 +107,7 @@ tf_cc_binary(
         "//tensorflow/compiler/mlir:init_mlir",
         "//tensorflow/compiler/mlir/tensorflow",
         "//tensorflow/core:lib",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/strings",
         "@llvm-project//llvm:AArch64CodeGen",  # fixdeps: keep
         "@llvm-project//llvm:ARMCodeGen",  # fixdeps: keep
diff --git a/tensorflow/distribute/experimental/rpc/kernels/BUILD b/tensorflow/distribute/experimental/rpc/kernels/BUILD
index f9a525364c5..8b7f7b54761 100644
--- a/tensorflow/distribute/experimental/rpc/kernels/BUILD
+++ b/tensorflow/distribute/experimental/rpc/kernels/BUILD
@@ -65,6 +65,7 @@ tf_kernel_library(
         "//tensorflow/distribute/experimental/rpc/proto:tf_rpc_service_proto_cc",
         "@com_github_grpc_grpc//:grpc++",
         "@com_google_absl//absl/status",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/strings",
         "@com_google_absl//absl/strings:str_format",
     ],
diff --git a/third_party/absl/system.absl.debugging.BUILD b/third_party/absl/system.absl.debugging.BUILD
index 931ffdc9e92..223db7b4c46 100644
--- a/third_party/absl/system.absl.debugging.BUILD
+++ b/third_party/absl/system.absl.debugging.BUILD
@@ -26,15 +26,25 @@ cc_library(
 
 cc_library(
     name = "failure_signal_handler",
-    linkopts = [
-        "-labsl_failure_signal_handler",
-        "-labsl_examine_stack",
+    linkopts = ["-labsl_failure_signal_handler"],
+    deps = [
+        ":examine_stack",
+        ":stacktrace",
+        "//absl/base",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/base:raw_logging_internal",
     ],
+)
+
+cc_library(
+    name = "examine_stack",
+    linkopts = ["-labsl_examine_stack"],
     deps = [
         ":stacktrace",
         ":symbolize",
-        "//absl/base",
-        "//absl/base:errno_saver",
+        "//absl/base:config",
+        "//absl/base:core_headers",
         "//absl/base:raw_logging_internal",
     ],
 )
diff --git a/third_party/absl/system.absl.log.BUILD b/third_party/absl/system.absl.log.BUILD
new file mode 100644
index 00000000000..9a2a5de657e
--- /dev/null
+++ b/third_party/absl/system.absl.log.BUILD
@@ -0,0 +1,271 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+    name = "log",
+    deps = [
+        "//absl/log:internal_log_impl",
+    ],
+)
+
+cc_library(
+    name = "internal_log_impl",
+    deps = [
+        ":internal_conditions",
+        ":internal_message",
+        ":internal_strip",
+    ],
+)
+
+cc_library(
+    name = "internal_conditions",
+    linkopts = ["-labsl_log_internal_conditions"],
+    deps = [
+        ":internal_voidify",
+        "//absl/base",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+    ],
+)
+
+cc_library(
+    name = "internal_voidify",
+    deps = ["//absl/base:config"],
+)
+
+cc_library(
+    name = "internal_message",
+    linkopts = ["-labsl_log_internal_message"],
+    deps = [
+        ":entry",
+        ":globals",
+        ":internal_append_truncated",
+        ":internal_format",
+        ":internal_globals",
+        ":internal_log_sink_set",
+        ":internal_nullguard",
+        ":internal_proto",
+        ":severity",
+        ":sink",
+        ":sink_registry",
+        "//absl/base",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/base:errno_saver",
+        "//absl/base:raw_logging_internal",
+        "//absl/base:strerror",
+        "//absl/container:inlined_vector",
+        "//absl/debugging:examine_stack",
+        "//absl/memory",
+        "//absl/strings",
+        "//absl/time",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "internal_append_truncated",
+    deps = [
+        "//absl/base:config",
+        "//absl/strings",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "internal_format",
+    linkopts = ["-labsl_log_internal_format"],
+    deps = [
+        ":internal_append_truncated",
+        ":internal_config",
+        ":internal_globals",
+        ":severity",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/strings",
+        "//absl/strings:str_format",
+        "//absl/time",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "internal_globals",
+    linkopts = ["-labsl_log_internal_globals"],
+    deps = [
+        ":severity",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/base:raw_logging_internal",
+        "//absl/strings",
+        "//absl/time",
+    ],
+)
+
+cc_library(
+    name = "internal_proto",
+    linkopts = ["-labsl_log_internal_proto"],
+    deps = [
+        "//absl/base",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/strings",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "internal_log_sink_set",
+    linkopts = ["-labsl_log_internal_log_sink_set"],
+    deps = [
+        ":entry",
+        ":globals",
+        ":internal_config",
+        ":internal_globals",
+        ":severity",
+        ":sink",
+        "//absl/base",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/base:raw_logging_internal",
+        "//absl/cleanup",
+        "//absl/strings",
+        "//absl/synchronization",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "internal_config",
+    deps = [
+        "//absl/base:config",
+        "//absl/base:core_headers",
+    ],
+)
+
+cc_library(
+    name = "internal_nullguard",
+    linkopts = ["-labsl_log_internal_nullguard"],
+    deps = [
+        "//absl/base:config",
+        "//absl/base:core_headers",
+    ],
+)
+
+cc_library(
+    name = "globals",
+    linkopts = ["-labsl_log_globals"],
+    deps = [
+        ":severity",
+        "//absl/base:atomic_hook",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/base:raw_logging_internal",
+        "//absl/hash",
+        "//absl/strings",
+    ],
+)
+
+cc_library(
+    name = "entry",
+    linkopts = ["-labsl_log_entry"],
+    deps = [
+        ":internal_config",
+        ":severity",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/strings",
+        "//absl/time",
+        "//absl/types:span",
+    ],
+)
+
+cc_library(
+    name = "severity",
+    linkopts = ["-labsl_log_severity"],
+    deps = ["//absl/base:core_headers"],
+)
+
+cc_library(
+    name = "sink",
+    linkopts = ["-labsl_log_sink"],
+    deps = [
+        ":entry",
+        "//absl/base:config",
+    ],
+)
+
+cc_library(
+    name = "sink_registry",
+    deps = [
+        ":internal_log_sink_set",
+        ":sink",
+        "//absl/base:config",
+    ],
+)
+
+cc_library(
+    name = "internal_strip",
+    deps = [
+        ":internal_message",
+        ":internal_nullstream",
+        ":severity",
+    ],
+)
+
+cc_library(
+    name = "internal_nullstream",
+    deps = [
+        ":severity",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/strings",
+    ],
+)
+
+cc_library(
+    name = "check",
+    deps = [
+        ":internal_check_impl",
+        ":internal_check_op",
+        ":internal_conditions",
+        ":internal_message",
+        ":internal_strip",
+        "//absl/base:core_headers",
+    ],
+)
+
+cc_library(
+    name = "internal_check_impl",
+    deps = [
+        ":internal_check_op",
+        ":internal_conditions",
+        ":internal_message",
+        ":internal_strip",
+        "//absl/base:core_headers",
+    ],
+)
+
+cc_library(
+    name = "internal_check_op",
+    linkopts = ["-labsl_log_internal_check_op"],
+    deps = [
+        ":internal_nullguard",
+        ":internal_nullstream",
+        ":internal_strip",
+        "//absl/base:config",
+        "//absl/base:core_headers",
+        "//absl/strings",
+    ],
+)
+
+cc_library(
+    name = "absl_check",
+    deps = [":internal_check_impl"],
+)
+
+cc_library(
+    name = "absl_log",
+    deps = [":internal_log_impl"],
+)
diff --git a/third_party/absl/workspace.bzl b/third_party/absl/workspace.bzl
index 07f49cebb78..a7f4e5ffc44 100644
--- a/third_party/absl/workspace.bzl
+++ b/third_party/absl/workspace.bzl
@@ -20,6 +20,7 @@ def repo():
         "flags",
         "functional",
         "hash",
+        "log",
         "memory",
         "meta",
         "numeric",
-- 
2.41.0

