From e2b52c093541d45ab22e82587c5a0083caf84e6b Mon Sep 17 00:00:00 2001
From: Gunhan Gulsoy <gunan@google.com>
Date: Wed, 27 Nov 2019 10:58:43 -0800
Subject: [PATCH] Remove dependency on lib/core:status within
 tensorflow/core/platform

PiperOrigin-RevId: 282799700
Change-Id: I6bbff913e7f07189a92328faffeaa7197925eafa
---
 tensorflow/core/platform/BUILD                       |  4 ++--
 tensorflow/core/platform/cloud/auth_provider.h       |  3 ++-
 .../platform/cloud/compute_engine_metadata_client.h  |  2 +-
 tensorflow/core/platform/cloud/curl_http_request.h   |  3 ++-
 tensorflow/core/platform/cloud/file_block_cache.h    |  3 ++-
 tensorflow/core/platform/cloud/gcs_file_system.h     |  2 +-
 tensorflow/core/platform/cloud/http_request.h        |  3 ++-
 tensorflow/core/platform/cloud/http_request_fake.h   |  3 ++-
 tensorflow/core/platform/cloud/oauth_client.h        |  3 ++-
 .../core/platform/cloud/ram_file_block_cache.h       |  3 ++-
 .../core/platform/cloud/retrying_file_system.h       |  2 +-
 tensorflow/core/platform/cloud/retrying_utils.h      |  3 ++-
 tensorflow/core/platform/cloud/time_util.h           |  2 +-
 tensorflow/core/platform/cloud/zone_provider.h       |  3 ++-
 tensorflow/core/platform/default/build_refactor.bzl  | 12 ++++++------
 .../core/platform/default/human_readable_json.cc     |  2 +-
 .../core/platform/default/posix_file_system.cc       |  2 +-
 tensorflow/core/platform/env.h                       |  2 +-
 tensorflow/core/platform/error.cc                    |  2 +-
 tensorflow/core/platform/error.h                     |  2 +-
 tensorflow/core/platform/file_system_helper.cc       |  2 +-
 tensorflow/core/platform/file_system_helper.h        |  2 +-
 .../core/platform/hadoop/hadoop_file_system.cc       |  2 +-
 tensorflow/core/platform/human_readable_json.h       |  2 +-
 tensorflow/core/platform/load_library.h              |  2 +-
 25 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/tensorflow/core/platform/BUILD b/tensorflow/core/platform/BUILD
index 8c676bc16e2..1c85e9d0769 100644
--- a/tensorflow/core/platform/BUILD
+++ b/tensorflow/core/platform/BUILD
@@ -173,9 +173,9 @@ cc_library(
     hdrs = ["error.h"],
     deps = [
         ":platform",
+        ":status",
+        ":strcat",
         ":types",
-        "//tensorflow/core/lib/core:status",
-        "//tensorflow/core/platform:strcat",
     ],
 )
 
diff --git a/tensorflow/core/platform/cloud/auth_provider.h b/tensorflow/core/platform/cloud/auth_provider.h
index 7347bc626d8..4c219b70221 100644
--- a/tensorflow/core/platform/cloud/auth_provider.h
+++ b/tensorflow/core/platform/cloud/auth_provider.h
@@ -17,8 +17,9 @@ limitations under the License.
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_AUTH_PROVIDER_H_
 
 #include <string>
+
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/compute_engine_metadata_client.h b/tensorflow/core/platform/cloud/compute_engine_metadata_client.h
index 7f060327da5..d7611615606 100644
--- a/tensorflow/core/platform/cloud/compute_engine_metadata_client.h
+++ b/tensorflow/core/platform/cloud/compute_engine_metadata_client.h
@@ -16,9 +16,9 @@ limitations under the License.
 #ifndef TENSORFLOW_CORE_PLATFORM_CLOUD_COMPUTE_ENGINE_METADATA_CLIENT_H_
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_COMPUTE_ENGINE_METADATA_CLIENT_H_
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/cloud/http_request.h"
 #include "tensorflow/core/platform/cloud/retrying_utils.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/curl_http_request.h b/tensorflow/core/platform/cloud/curl_http_request.h
index 9ad75e52f20..ddb1599e871 100644
--- a/tensorflow/core/platform/cloud/curl_http_request.h
+++ b/tensorflow/core/platform/cloud/curl_http_request.h
@@ -19,14 +19,15 @@ limitations under the License.
 #include <string>
 #include <unordered_map>
 #include <vector>
+
 #include <curl/curl.h>
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/core/stringpiece.h"
 #include "tensorflow/core/platform/cloud/http_request.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/macros.h"
 #include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/types.h"
 
 namespace tensorflow {
diff --git a/tensorflow/core/platform/cloud/file_block_cache.h b/tensorflow/core/platform/cloud/file_block_cache.h
index c98b10640fa..3e66a9937a6 100644
--- a/tensorflow/core/platform/cloud/file_block_cache.h
+++ b/tensorflow/core/platform/cloud/file_block_cache.h
@@ -22,11 +22,12 @@ limitations under the License.
 #include <memory>
 #include <string>
 #include <vector>
-#include "tensorflow/core/lib/core/status.h"
+
 #include "tensorflow/core/lib/core/stringpiece.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/mutex.h"
 #include "tensorflow/core/platform/notification.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/thread_annotations.h"
 #include "tensorflow/core/platform/types.h"
 
diff --git a/tensorflow/core/platform/cloud/gcs_file_system.h b/tensorflow/core/platform/cloud/gcs_file_system.h
index 0bd95f7c6b6..a4d3bcc8f05 100644
--- a/tensorflow/core/platform/cloud/gcs_file_system.h
+++ b/tensorflow/core/platform/cloud/gcs_file_system.h
@@ -21,7 +21,6 @@ limitations under the License.
 #include <utility>
 #include <vector>
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/cloud/auth_provider.h"
 #include "tensorflow/core/platform/cloud/compute_engine_metadata_client.h"
 #include "tensorflow/core/platform/cloud/compute_engine_zone_provider.h"
@@ -32,6 +31,7 @@ limitations under the License.
 #include "tensorflow/core/platform/cloud/http_request.h"
 #include "tensorflow/core/platform/cloud/retrying_file_system.h"
 #include "tensorflow/core/platform/file_system.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/http_request.h b/tensorflow/core/platform/cloud/http_request.h
index e925eefb1f2..91825b5958a 100644
--- a/tensorflow/core/platform/cloud/http_request.h
+++ b/tensorflow/core/platform/cloud/http_request.h
@@ -19,12 +19,13 @@ limitations under the License.
 #include <string>
 #include <unordered_map>
 #include <vector>
+
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/core/stringpiece.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/macros.h"
 #include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/types.h"
 
 namespace tensorflow {
diff --git a/tensorflow/core/platform/cloud/http_request_fake.h b/tensorflow/core/platform/cloud/http_request_fake.h
index 0a1164b64a7..f1bed661715 100644
--- a/tensorflow/core/platform/cloud/http_request_fake.h
+++ b/tensorflow/core/platform/cloud/http_request_fake.h
@@ -20,14 +20,15 @@ limitations under the License.
 #include <fstream>
 #include <string>
 #include <vector>
+
 #include <curl/curl.h>
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/core/status_test_util.h"
 #include "tensorflow/core/lib/core/stringpiece.h"
 #include "tensorflow/core/platform/cloud/curl_http_request.h"
 #include "tensorflow/core/platform/macros.h"
 #include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/test.h"
 #include "tensorflow/core/platform/types.h"
 
diff --git a/tensorflow/core/platform/cloud/oauth_client.h b/tensorflow/core/platform/cloud/oauth_client.h
index 519d69acf98..ed8bf257253 100644
--- a/tensorflow/core/platform/cloud/oauth_client.h
+++ b/tensorflow/core/platform/cloud/oauth_client.h
@@ -17,10 +17,11 @@ limitations under the License.
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_OAUTH_CLIENT_H_
 
 #include <memory>
+
 #include "include/json/json.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/cloud/http_request.h"
 #include "tensorflow/core/platform/env.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/ram_file_block_cache.h b/tensorflow/core/platform/cloud/ram_file_block_cache.h
index 46fb9a35b88..d418a0fb6b0 100644
--- a/tensorflow/core/platform/cloud/ram_file_block_cache.h
+++ b/tensorflow/core/platform/cloud/ram_file_block_cache.h
@@ -22,12 +22,13 @@ limitations under the License.
 #include <memory>
 #include <string>
 #include <vector>
-#include "tensorflow/core/lib/core/status.h"
+
 #include "tensorflow/core/lib/core/stringpiece.h"
 #include "tensorflow/core/platform/cloud/file_block_cache.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/mutex.h"
 #include "tensorflow/core/platform/notification.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/thread_annotations.h"
 #include "tensorflow/core/platform/types.h"
 
diff --git a/tensorflow/core/platform/cloud/retrying_file_system.h b/tensorflow/core/platform/cloud/retrying_file_system.h
index 9659edd890e..5e85447fd3d 100644
--- a/tensorflow/core/platform/cloud/retrying_file_system.h
+++ b/tensorflow/core/platform/cloud/retrying_file_system.h
@@ -21,11 +21,11 @@ limitations under the License.
 #include <vector>
 
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/random/random.h"
 #include "tensorflow/core/platform/cloud/retrying_utils.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/file_system.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/retrying_utils.h b/tensorflow/core/platform/cloud/retrying_utils.h
index 1a7ce1b122b..70b98463477 100644
--- a/tensorflow/core/platform/cloud/retrying_utils.h
+++ b/tensorflow/core/platform/cloud/retrying_utils.h
@@ -17,7 +17,8 @@ limitations under the License.
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_RETRYING_UTILS_H_
 
 #include <functional>
-#include "tensorflow/core/lib/core/status.h"
+
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/time_util.h b/tensorflow/core/platform/cloud/time_util.h
index d6d4bc499fe..944efe9bbd4 100644
--- a/tensorflow/core/platform/cloud/time_util.h
+++ b/tensorflow/core/platform/cloud/time_util.h
@@ -16,7 +16,7 @@ limitations under the License.
 #ifndef TENSORFLOW_CORE_PLATFORM_CLOUD_TIME_UTIL_H_
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_TIME_UTIL_H_
 
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/cloud/zone_provider.h b/tensorflow/core/platform/cloud/zone_provider.h
index 421b6a7e1af..6f809ceb381 100644
--- a/tensorflow/core/platform/cloud/zone_provider.h
+++ b/tensorflow/core/platform/cloud/zone_provider.h
@@ -17,8 +17,9 @@ limitations under the License.
 #define TENSORFLOW_CORE_PLATFORM_CLOUD_ZONE_PROVIDER_H_
 
 #include <string>
+
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/default/build_refactor.bzl b/tensorflow/core/platform/default/build_refactor.bzl
index e7eddeb3343..eb12e6b5585 100644
--- a/tensorflow/core/platform/default/build_refactor.bzl
+++ b/tensorflow/core/platform/default/build_refactor.bzl
@@ -80,7 +80,6 @@ TF_DEFAULT_PLATFORM_LIBRARIES = {
             "//tensorflow/core/lib/core:blocking_counter",
             "//tensorflow/core/lib/core:error_codes_proto_cc",
             "//tensorflow/core/lib/core:errors",
-            "//tensorflow/core/lib/core:status",
             "//tensorflow/core/lib/core:stringpiece",
             "//tensorflow/core/lib/io:path",
             "//tensorflow/core/platform",
@@ -97,6 +96,7 @@ TF_DEFAULT_PLATFORM_LIBRARIES = {
             "//tensorflow/core/platform:platform_port",
             "//tensorflow/core/platform:protobuf",
             "//tensorflow/core/platform:setround",
+            "//tensorflow/core/platform:status",
             "//tensorflow/core/platform:stringpiece",
             "//tensorflow/core/platform:stringprintf",
             "//tensorflow/core/platform:strcat",
@@ -132,9 +132,9 @@ TF_DEFAULT_PLATFORM_LIBRARIES = {
         ],
         "deps": [
             "//tensorflow/core/lib/core:errors",
-            "//tensorflow/core/lib/core:status",
-            "//tensorflow/core/platform:strcat",
             "//tensorflow/core/platform:protobuf",
+            "//tensorflow/core/platform:status",
+            "//tensorflow/core/platform:strcat",
         ],
         "visibility": ["//visibility:private"],
         "tags": ["no_oss", "manual"],
@@ -149,7 +149,7 @@ TF_DEFAULT_PLATFORM_LIBRARIES = {
         ],
         "deps": [
             "//tensorflow/core/lib/core:errors",
-            "//tensorflow/core/lib/core:status",
+            "//tensorflow/core/platform:status",
         ],
         "visibility": ["//visibility:private"],
         "tags": ["no_oss", "manual"],
@@ -405,7 +405,6 @@ TF_WINDOWS_PLATFORM_LIBRARIES = {
             "//tensorflow/core/lib/core:blocking_counter",
             "//tensorflow/core/lib/core:error_codes_proto_cc",
             "//tensorflow/core/lib/core:errors",
-            "//tensorflow/core/lib/core:status",
             "//tensorflow/core/lib/core:stringpiece",
             "//tensorflow/core/lib/io:path",
             "//tensorflow/core/platform",
@@ -422,6 +421,7 @@ TF_WINDOWS_PLATFORM_LIBRARIES = {
             "//tensorflow/core/platform:platform_port",
             "//tensorflow/core/platform:protobuf",
             "//tensorflow/core/platform:setround",
+            "//tensorflow/core/platform:status",
             "//tensorflow/core/platform:stringpiece",
             "//tensorflow/core/platform:stringprintf",
             "//tensorflow/core/platform:strcat",
@@ -458,7 +458,7 @@ TF_WINDOWS_PLATFORM_LIBRARIES = {
         ],
         "deps": [
             "//tensorflow/core/lib/core:errors",
-            "//tensorflow/core/lib/core:status",
+            "//tensorflow/core/platform:status",
             "//tensorflow/core/platform:windows_wide_char_impl",
         ],
         "visibility": ["//visibility:private"],
diff --git a/tensorflow/core/platform/default/human_readable_json.cc b/tensorflow/core/platform/default/human_readable_json.cc
index c3a61a3d58c..2ecbf437800 100644
--- a/tensorflow/core/platform/default/human_readable_json.cc
+++ b/tensorflow/core/platform/default/human_readable_json.cc
@@ -16,7 +16,7 @@ limitations under the License.
 #include "tensorflow/core/platform/human_readable_json.h"
 
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/strcat.h"
 
 namespace tensorflow {
diff --git a/tensorflow/core/platform/default/posix_file_system.cc b/tensorflow/core/platform/default/posix_file_system.cc
index 56c00279e6b..106a0412fb7 100644
--- a/tensorflow/core/platform/default/posix_file_system.cc
+++ b/tensorflow/core/platform/default/posix_file_system.cc
@@ -28,12 +28,12 @@ limitations under the License.
 #include <time.h>
 #include <unistd.h>
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/default/posix_file_system.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/error.h"
 #include "tensorflow/core/platform/file_system_helper.h"
 #include "tensorflow/core/platform/logging.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/strcat.h"
 #include "tensorflow/core/protobuf/error_codes.pb.h"
 
diff --git a/tensorflow/core/platform/env.h b/tensorflow/core/platform/env.h
index be8399c879b..cd6a6488e52 100644
--- a/tensorflow/core/platform/env.h
+++ b/tensorflow/core/platform/env.h
@@ -24,7 +24,6 @@ limitations under the License.
 #include <vector>
 
 #include "tensorflow/core/lib/core/errors.h"
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/env_time.h"
 #include "tensorflow/core/platform/file_system.h"
 #include "tensorflow/core/platform/macros.h"
@@ -32,6 +31,7 @@ limitations under the License.
 #include "tensorflow/core/platform/numa.h"
 #include "tensorflow/core/platform/platform.h"
 #include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/stringpiece.h"
 #include "tensorflow/core/platform/types.h"
 
diff --git a/tensorflow/core/platform/error.cc b/tensorflow/core/platform/error.cc
index 00ddf1dc241..cb09a3a86cc 100644
--- a/tensorflow/core/platform/error.cc
+++ b/tensorflow/core/platform/error.cc
@@ -18,7 +18,7 @@ limitations under the License.
 #include <errno.h>
 #include <string.h>
 
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/strcat.h"
 
 namespace tensorflow {
diff --git a/tensorflow/core/platform/error.h b/tensorflow/core/platform/error.h
index 3ba3e749c34..0b08ac36682 100644
--- a/tensorflow/core/platform/error.h
+++ b/tensorflow/core/platform/error.h
@@ -18,8 +18,8 @@ limitations under the License.
 
 #include <string>
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/platform.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/file_system_helper.cc b/tensorflow/core/platform/file_system_helper.cc
index e47fa133c6d..c909b36688e 100644
--- a/tensorflow/core/platform/file_system_helper.cc
+++ b/tensorflow/core/platform/file_system_helper.cc
@@ -19,11 +19,11 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/io/path.h"
 #include "tensorflow/core/platform/env.h"
 #include "tensorflow/core/platform/file_system.h"
 #include "tensorflow/core/platform/platform.h"
+#include "tensorflow/core/platform/status.h"
 #include "tensorflow/core/platform/str_util.h"
 #include "tensorflow/core/platform/threadpool.h"
 
diff --git a/tensorflow/core/platform/file_system_helper.h b/tensorflow/core/platform/file_system_helper.h
index 8d812b0e381..7427dea77ef 100644
--- a/tensorflow/core/platform/file_system_helper.h
+++ b/tensorflow/core/platform/file_system_helper.h
@@ -19,7 +19,7 @@ limitations under the License.
 #include <string>
 #include <vector>
 
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/hadoop/hadoop_file_system.cc b/tensorflow/core/platform/hadoop/hadoop_file_system.cc
index 59c3fe2540f..60668ff4f61 100644
--- a/tensorflow/core/platform/hadoop/hadoop_file_system.cc
+++ b/tensorflow/core/platform/hadoop/hadoop_file_system.cc
@@ -17,7 +17,6 @@ limitations under the License.
 
 #include <errno.h>
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/lib/io/path.h"
 #include "tensorflow/core/lib/strings/strcat.h"
 #include "tensorflow/core/platform/env.h"
@@ -26,6 +25,7 @@ limitations under the License.
 #include "tensorflow/core/platform/file_system_helper.h"
 #include "tensorflow/core/platform/logging.h"
 #include "tensorflow/core/platform/mutex.h"
+#include "tensorflow/core/platform/status.h"
 #include "third_party/hadoop/hdfs.h"
 
 namespace tensorflow {
diff --git a/tensorflow/core/platform/human_readable_json.h b/tensorflow/core/platform/human_readable_json.h
index 49908eac7c8..f6830e20207 100644
--- a/tensorflow/core/platform/human_readable_json.h
+++ b/tensorflow/core/platform/human_readable_json.h
@@ -16,8 +16,8 @@ limitations under the License.
 #ifndef TENSORFLOW_CORE_PLATFORM_HUMAN_READABLE_JSON_H_
 #define TENSORFLOW_CORE_PLATFORM_HUMAN_READABLE_JSON_H_
 
-#include "tensorflow/core/lib/core/status.h"
 #include "tensorflow/core/platform/protobuf.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {
 
diff --git a/tensorflow/core/platform/load_library.h b/tensorflow/core/platform/load_library.h
index c7eeb2918ca..01efd4c1d01 100644
--- a/tensorflow/core/platform/load_library.h
+++ b/tensorflow/core/platform/load_library.h
@@ -16,7 +16,7 @@ limitations under the License.
 #ifndef TENSORFLOW_CORE_PLATFORM_LOAD_LIBRARY_H_
 #define TENSORFLOW_CORE_PLATFORM_LOAD_LIBRARY_H_
 
-#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/platform/status.h"
 
 namespace tensorflow {