diff --git a/.bazelrc b/.bazelrc index 99bf0c9166b..9ac5a1bbf40 100644 --- a/.bazelrc +++ b/.bazelrc @@ -123,11 +123,6 @@ build:monolithic --define framework_shared_object=false # opts in to modular op registration support by default. build --define framework_shared_object=true -# As part of Tensorflow's build refactoring, https://github.com/tensorflow/community/pull/179, -# we plan on migrating TF to use bazel's cc_shared_library. This requires always setting -# the flag "--experimental_cc_shared_library" on all builds: https://github.com/bazelbuild/rules_cc/blob/7e650b11fe6d49f70f2ca7a1c4cb8bcc4a1fe239/examples/experimental_cc_shared_library.bzl#L3-L5 -build --experimental_cc_shared_library - # Flags for open source build, always set to be true. build --define open_source_build=true test --define open_source_build=true diff --git a/tensorflow/BUILD b/tensorflow/BUILD index 6bfcdca7a9e..d8a681c3999 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -478,7 +478,6 @@ bzl_library( visibility = ["//visibility:public"], deps = [ "//tensorflow/core/platform:build_config_root_bzl", - "//tensorflow/core/platform:rules_cc_bzl", "//tensorflow/core/platform/default:cuda_build_defs_bzl", "//third_party/mkl:build_defs_bzl", "//third_party/mkl_dnn:build_defs_bzl", diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index d70ef895fea..b32acbedcf1 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -132,10 +132,6 @@ load( "tf_protos_profiler_impl", "tf_pyclif_proto_library", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) load( "//tensorflow/core/platform:build_config_root.bzl", "if_dynamic_kernels", diff --git a/tensorflow/core/framework/BUILD b/tensorflow/core/framework/BUILD index 70635a36a47..eae10268f5d 100644 --- a/tensorflow/core/framework/BUILD +++ b/tensorflow/core/framework/BUILD @@ -15,10 +15,6 @@ load( "//tensorflow/core/platform:build_config_root.bzl", "if_static", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = [ diff --git a/tensorflow/core/lib/bfloat16/BUILD b/tensorflow/core/lib/bfloat16/BUILD index d78bee42461..4f955c37f3f 100644 --- a/tensorflow/core/lib/bfloat16/BUILD +++ b/tensorflow/core/lib/bfloat16/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ "//tensorflow:__subpackages__", diff --git a/tensorflow/core/lib/core/BUILD b/tensorflow/core/lib/core/BUILD index 28213f0b790..a3ed21f8771 100644 --- a/tensorflow/core/lib/core/BUILD +++ b/tensorflow/core/lib/core/BUILD @@ -1,8 +1,4 @@ load("//tensorflow/core/platform:build_config.bzl", "tf_proto_library") -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = [ diff --git a/tensorflow/core/lib/db/BUILD b/tensorflow/core/lib/db/BUILD index b3b941a2dfd..bf24de9a70c 100644 --- a/tensorflow/core/lib/db/BUILD +++ b/tensorflow/core/lib/db/BUILD @@ -2,10 +2,6 @@ # Libraries for storing tensors in SQL databases. load("//tensorflow:tensorflow.bzl", "tf_cc_test", "tf_copts") -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = ["//tensorflow:internal"], diff --git a/tensorflow/core/lib/gtl/BUILD b/tensorflow/core/lib/gtl/BUILD index 4adae6575eb..ffac0ce12ea 100644 --- a/tensorflow/core/lib/gtl/BUILD +++ b/tensorflow/core/lib/gtl/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/lib/hash/BUILD b/tensorflow/core/lib/hash/BUILD index 1d7039fbcd2..ffe5ef957c2 100644 --- a/tensorflow/core/lib/hash/BUILD +++ b/tensorflow/core/lib/hash/BUILD @@ -3,10 +3,6 @@ load( "if_linux_x86_64", "tf_copts", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = [ diff --git a/tensorflow/core/lib/histogram/BUILD b/tensorflow/core/lib/histogram/BUILD index de72187a5bf..9108a09dd15 100644 --- a/tensorflow/core/lib/histogram/BUILD +++ b/tensorflow/core/lib/histogram/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/lib/io/BUILD b/tensorflow/core/lib/io/BUILD index 5616b8153b7..8f8e0dd0da8 100644 --- a/tensorflow/core/lib/io/BUILD +++ b/tensorflow/core/lib/io/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ "//tensorflow/c/experimental/filesystem:__pkg__", diff --git a/tensorflow/core/lib/math/BUILD b/tensorflow/core/lib/math/BUILD index 063e5db5401..07d0a3e07cd 100644 --- a/tensorflow/core/lib/math/BUILD +++ b/tensorflow/core/lib/math/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ "//tensorflow:__subpackages__", diff --git a/tensorflow/core/lib/monitoring/BUILD b/tensorflow/core/lib/monitoring/BUILD index 62744a5e3e0..ef796fd4663 100644 --- a/tensorflow/core/lib/monitoring/BUILD +++ b/tensorflow/core/lib/monitoring/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/lib/png/BUILD b/tensorflow/core/lib/png/BUILD index db2ab4801ee..56bdba7172a 100644 --- a/tensorflow/core/lib/png/BUILD +++ b/tensorflow/core/lib/png/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/lib/random/BUILD b/tensorflow/core/lib/random/BUILD index 019797b1dda..770d00051e3 100644 --- a/tensorflow/core/lib/random/BUILD +++ b/tensorflow/core/lib/random/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/lib/strings/BUILD b/tensorflow/core/lib/strings/BUILD index 3308edd04bf..31425aabc10 100644 --- a/tensorflow/core/lib/strings/BUILD +++ b/tensorflow/core/lib/strings/BUILD @@ -1,8 +1,3 @@ -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) - package( default_visibility = [ # tensorflow/core:lib effectively exposes all targets under tensorflow/core/lib/** diff --git a/tensorflow/core/platform/BUILD b/tensorflow/core/platform/BUILD index dea8cd1353e..5dfeeb89c43 100644 --- a/tensorflow/core/platform/BUILD +++ b/tensorflow/core/platform/BUILD @@ -30,11 +30,6 @@ load( "tf_protobuf_deps", "tf_windows_aware_platform_deps", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_binary", - "cc_library", -) load( "//tensorflow:tensorflow.bzl", "if_not_android", @@ -1467,12 +1462,6 @@ bzl_library( name = "build_config_root_bzl", srcs = [ "build_config_root.bzl", - ] + tf_platform_alias("build_config_root.bzl"), -) - -bzl_library( - name = "rules_cc_bzl", - srcs = [ - "rules_cc.bzl", - ] + tf_platform_alias("rules_cc.bzl"), + "//tensorflow/core/platform/default:build_config_root.bzl", + ], ) diff --git a/tensorflow/core/platform/default/BUILD b/tensorflow/core/platform/default/BUILD index 41e3d65574f..346018153d5 100644 --- a/tensorflow/core/platform/default/BUILD +++ b/tensorflow/core/platform/default/BUILD @@ -1,10 +1,6 @@ # Tensorflow default + linux implementations of tensorflow/core/platform libraries. load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//tensorflow:tensorflow.bzl", "tf_copts") -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = [ diff --git a/tensorflow/core/platform/windows/BUILD b/tensorflow/core/platform/windows/BUILD index 7ed2518f216..f3a995bcff6 100644 --- a/tensorflow/core/platform/windows/BUILD +++ b/tensorflow/core/platform/windows/BUILD @@ -4,10 +4,6 @@ load( "if_windows", "tf_copts", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) package( default_visibility = [ diff --git a/tensorflow/core/util/BUILD b/tensorflow/core/util/BUILD index f60c77ffebb..2e4ea69659e 100644 --- a/tensorflow/core/util/BUILD +++ b/tensorflow/core/util/BUILD @@ -3,10 +3,6 @@ load( "tf_kernel_tests_linkstatic", "tf_proto_library", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_library", -) load( "//tensorflow:tensorflow.bzl", "tf_cc_test", diff --git a/tensorflow/opensource_only.files b/tensorflow/opensource_only.files index bdd63ee94aa..8e986d3c7d4 100644 --- a/tensorflow/opensource_only.files +++ b/tensorflow/opensource_only.files @@ -147,7 +147,6 @@ tensorflow/third_party/pybind11.BUILD tensorflow/third_party/python_runtime/BUILD tensorflow/third_party/repo.bzl tensorflow/third_party/rules_closure.patch -tensorflow/third_party/rules_swift.patch tensorflow/third_party/six.BUILD tensorflow/third_party/snappy.BUILD tensorflow/third_party/sqlite.BUILD diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 4e5f01f1e20..b82e7b9c4eb 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -11,12 +11,6 @@ load( "tf_gpu_tests_tags", "tf_sycl_tests_tags", ) -load( - "//tensorflow/core/platform:rules_cc.bzl", - "cc_binary", - "cc_library", - "cc_test", -) load( "@local_config_tensorrt//:build_defs.bzl", "if_tensorrt", @@ -117,7 +111,7 @@ def tf_android_core_proto_headers(core_proto_sources_relative): # Wrapper for portable protos which currently just creates an empty rule. def tf_portable_proto_library(name, proto_deps, deps = [], **kwargs): _ignore = [kwargs] - cc_library(name = name, deps = deps + [dep + "_cc" for dep in proto_deps]) + native.cc_library(name = name, deps = deps + [dep + "_cc" for dep in proto_deps]) # Sanitize a dependency so that it works correctly from code that includes # TensorFlow as a submodule. @@ -366,7 +360,7 @@ def tf_gen_op_libs(op_lib_names, deps = None, is_external = True): if not deps: deps = [] for n in op_lib_names: - cc_library( + native.cc_library( name = n + "_op_lib", copts = tf_copts(is_external = is_external), srcs = ["ops/" + n + ".cc"], @@ -570,7 +564,7 @@ def tf_cc_shared_object( if framework_so != []: data_extra = tf_binary_additional_data_deps() - cc_binary( + native.cc_binary( name = name_os_full, srcs = srcs + framework_so, deps = deps, @@ -631,7 +625,7 @@ def tf_cc_binary( else: names = [name] for name_os in names: - cc_binary( + native.cc_binary( name = name_os, copts = copts, srcs = srcs + tf_binary_additional_srcs(), @@ -674,7 +668,7 @@ def tf_native_cc_binary( copts = tf_copts(), linkopts = [], **kwargs): - cc_binary( + native.cc_binary( name = name, copts = copts, linkopts = select({ @@ -814,7 +808,7 @@ def tf_gen_op_wrappers_cc( internalsrcs += ["ops/" + n + "_internal.cc"] internalhdrs += ["ops/" + n + "_internal.h"] - cc_library( + native.cc_library( name = name, srcs = subsrcs, hdrs = subhdrs, @@ -831,7 +825,7 @@ def tf_gen_op_wrappers_cc( alwayslink = 1, visibility = visibility, ) - cc_library( + native.cc_library( name = name + "_internal", srcs = internalsrcs, hdrs = internalhdrs, @@ -995,7 +989,7 @@ def tf_cc_test( linkopts = [], kernels = [], **kwargs): - cc_test( + native.cc_test( name = "%s%s" % (name, suffix), srcs = srcs + tf_binary_additional_srcs(), copts = tf_copts() + extra_copts, @@ -1152,7 +1146,7 @@ def tf_gpu_only_cc_test( deps = deps, testonly = 1, ) - cc_test( + native.cc_test( name = "%s%s" % (name, "_gpu"), size = size, args = args, @@ -1239,7 +1233,7 @@ def tf_cc_test_mkl( disable_header_modules = ["-use_header_modules"] for src in srcs: - cc_test( + native.cc_test( name = src_to_test_name(src), srcs = if_mkl([src]) + tf_binary_additional_srcs(), copts = tf_copts(allow_exceptions = True) + tf_openmp_copts(), @@ -1401,7 +1395,7 @@ def tf_gpu_library(deps = None, cuda_deps = None, copts = tf_copts(), **kwargs): cuda_deps = [] kwargs["features"] = kwargs.get("features", []) + ["-use_header_modules"] - cc_library( + native.cc_library( deps = deps + if_cuda_is_configured_compat(cuda_deps + [ clean_dep("//tensorflow/stream_executor/cuda:cudart_stub"), "@local_config_cuda//cuda:cuda_headers", @@ -1569,7 +1563,7 @@ def tf_mkl_kernel_library( # -fno-exceptions in nocopts breaks compilation if header modules are enabled. disable_header_modules = ["-use_header_modules"] - cc_library( + native.cc_library( name = name, srcs = if_mkl(srcs), hdrs = hdrs, @@ -1722,7 +1716,7 @@ def transitive_hdrs(name, deps = [], **kwargs): # the libraries in deps. def cc_header_only_library(name, deps = [], includes = [], extra_deps = [], **kwargs): _transitive_hdrs(name = name + "_gather", deps = deps) - cc_library( + native.cc_library( name = name, hdrs = [":" + name + "_gather"], includes = includes, @@ -2370,7 +2364,7 @@ def tf_generate_proto_text_sources(name, srcs_relative_dir, srcs, protodeps = [] visibility = visibility, ) - cc_library( + native.cc_library( name = name, srcs = out_srcs, hdrs = out_hdrs, @@ -2426,7 +2420,7 @@ def cc_library_with_android_deps( copts = tf_copts(), **kwargs): deps = if_not_android(deps) + if_android(android_deps) + common_deps - cc_library(deps = deps, copts = copts, **kwargs) + native.cc_library(deps = deps, copts = copts, **kwargs) register_extension_info( extension_name = "cc_library_with_android_deps", @@ -2487,7 +2481,7 @@ def pybind_extension( visibility = ["//visibility:private"], testonly = testonly, ) - cc_binary( + native.cc_binary( name = so_file, srcs = srcs + hdrs, data = data, diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 1c3ce5f40c8..d6cf5c18dfb 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -903,7 +903,6 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""): # https://github.com/bazelbuild/rules_swift/releases tf_http_archive( name = "build_bazel_rules_swift", - patch_file = clean_dep("//third_party:rules_swift.patch"), sha256 = "18cd4df4e410b0439a4935f9ca035bd979993d42372ba79e7f2d4fafe9596ef0", urls = [ "http://mirror.tensorflow.org/github.com/bazelbuild/rules_swift/releases/download/0.12.1/rules_swift.0.12.1.tar.gz", diff --git a/third_party/rules_swift.patch b/third_party/rules_swift.patch deleted file mode 100644 index 5e4e24b40ce..00000000000 --- a/third_party/rules_swift.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4c1a4d676d1633ff9f67bda3540d24ea5fa31c8f Mon Sep 17 00:00:00 2001 -From: Brian Zhao -Date: Tue, 14 Jan 2020 18:23:34 -0800 -Subject: [PATCH] Adding linker_inputs flag to create_linking_context, in - preparation for bazel's cc_shared_library rule. Note that this cannot be - enabled as of now unless --experimental_cc_shared_library is passed to bazel. - ---- - swift/internal/utils.bzl | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/swift/internal/utils.bzl b/swift/internal/utils.bzl -index 5cf1498..44d7559 100644 ---- a/swift/internal/utils.bzl -+++ b/swift/internal/utils.bzl -@@ -98,6 +98,7 @@ def create_cc_info( - - this_cc_info = CcInfo( - linking_context = cc_common.create_linking_context( -+ linker_inputs = None, - additional_inputs = all_additional_inputs, - libraries_to_link = libraries_to_link, - user_link_flags = all_user_link_flags, --- -2.25.0.rc1.283.g88dfdc4193-goog