From 36910d3d7e9fccadd6603f232d0c4f54dcd47c7e Mon Sep 17 00:00:00 2001 From: Yannic Date: Fri, 16 Aug 2019 14:38:13 +0000 Subject: [bazel] Add fixes for --incompatible_load_cc_rules_from_bzl (#351) * [bazel] Add fixes for --incompatible_load_cc_rules_from_bzl Starting with Bazel 1.0 (September 2019), C++ rules will need to be loaded from the @rules_cc repository. This change adds the required loads for that. For full compatibility, we will need versions of googletest and google-benchmark that also includes these loads. * Run buildifier again after merge --- WORKSPACE | 11 +++++++++++ absl/algorithm/BUILD.bazel | 1 + absl/base/BUILD.bazel | 1 + absl/container/BUILD.bazel | 1 + absl/debugging/BUILD.bazel | 1 + absl/flags/BUILD.bazel | 1 + absl/hash/BUILD.bazel | 1 + absl/memory/BUILD.bazel | 3 ++- absl/meta/BUILD.bazel | 1 + absl/numeric/BUILD.bazel | 1 + absl/random/BUILD.bazel | 1 + absl/random/internal/BUILD.bazel | 2 ++ absl/strings/BUILD.bazel | 1 + absl/synchronization/BUILD.bazel | 1 + absl/time/BUILD.bazel | 1 + absl/time/internal/cctz/BUILD.bazel | 6 ++++-- absl/types/BUILD.bazel | 1 + absl/utility/BUILD.bazel | 1 + 18 files changed, 33 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 49e2d3cb..376464ef 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -27,3 +27,14 @@ http_archive( strip_prefix = "benchmark-16703ff83c1ae6d53e5155df3bb3ab0bc96083be", sha256 = "59f918c8ccd4d74b6ac43484467b500f1d64b40cc1010daa055375b322a43ba3", ) + +# C++ rules for Bazel. +http_archive( + name = "rules_cc", + sha256 = "67412176974bfce3f4cf8bdaff39784a72ed709fc58def599d1f68710b58d68b", + strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.zip", + "https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.zip", + ], +) diff --git a/absl/algorithm/BUILD.bazel b/absl/algorithm/BUILD.bazel index c506f3b9..2ee8c09e 100644 --- a/absl/algorithm/BUILD.bazel +++ b/absl/algorithm/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/base/BUILD.bazel b/absl/base/BUILD.bazel index bfdc7ab5..cd5dd74f 100644 --- a/absl/base/BUILD.bazel +++ b/absl/base/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/container/BUILD.bazel b/absl/container/BUILD.bazel index 90f4d0b7..45c90528 100644 --- a/absl/container/BUILD.bazel +++ b/absl/container/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/debugging/BUILD.bazel b/absl/debugging/BUILD.bazel index 760c481f..b87c55a5 100644 --- a/absl/debugging/BUILD.bazel +++ b/absl/debugging/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/flags/BUILD.bazel b/absl/flags/BUILD.bazel index 4720791a..c338dbee 100644 --- a/absl/flags/BUILD.bazel +++ b/absl/flags/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/hash/BUILD.bazel b/absl/hash/BUILD.bazel index 8c2daf70..d6d8dabc 100644 --- a/absl/hash/BUILD.bazel +++ b/absl/hash/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/memory/BUILD.bazel b/absl/memory/BUILD.bazel index 4dba6366..00f60657 100644 --- a/absl/memory/BUILD.bazel +++ b/absl/memory/BUILD.bazel @@ -14,13 +14,14 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", "ABSL_DEFAULT_LINKOPTS", - "ABSL_TEST_COPTS", "ABSL_EXCEPTIONS_FLAG", "ABSL_EXCEPTIONS_FLAG_LINKOPTS", + "ABSL_TEST_COPTS", ) package(default_visibility = ["//visibility:public"]) diff --git a/absl/meta/BUILD.bazel b/absl/meta/BUILD.bazel index e004b509..8db8dd6b 100644 --- a/absl/meta/BUILD.bazel +++ b/absl/meta/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/numeric/BUILD.bazel b/absl/numeric/BUILD.bazel index d9b561df..e09e52d2 100644 --- a/absl/numeric/BUILD.bazel +++ b/absl/numeric/BUILD.bazel @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/random/BUILD.bazel b/absl/random/BUILD.bazel index d09f0cb3..4e210e71 100644 --- a/absl/random/BUILD.bazel +++ b/absl/random/BUILD.bazel @@ -1,5 +1,6 @@ # ABSL random-number generation libraries. +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/random/internal/BUILD.bazel b/absl/random/internal/BUILD.bazel index d9581d00..5e7c16f3 100644 --- a/absl/random/internal/BUILD.bazel +++ b/absl/random/internal/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") + # Internal-only implementation classes for Abseil Random load( "//absl:copts/configure_copts.bzl", diff --git a/absl/strings/BUILD.bazel b/absl/strings/BUILD.bazel index 9679dc30..cb808416 100644 --- a/absl/strings/BUILD.bazel +++ b/absl/strings/BUILD.bazel @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/synchronization/BUILD.bazel b/absl/synchronization/BUILD.bazel index d40d861f..b4813388 100644 --- a/absl/synchronization/BUILD.bazel +++ b/absl/synchronization/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/time/BUILD.bazel b/absl/time/BUILD.bazel index 1c387e46..a615152f 100644 --- a/absl/time/BUILD.bazel +++ b/absl/time/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/time/internal/cctz/BUILD.bazel b/absl/time/internal/cctz/BUILD.bazel index b05c2347..c7cb6b9d 100644 --- a/absl/time/internal/cctz/BUILD.bazel +++ b/absl/time/internal/cctz/BUILD.bazel @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") + package(features = ["-parse_headers"]) licenses(["notice"]) # Apache License @@ -77,10 +79,10 @@ cc_library( "include/cctz/zone_info_source.h", ], linkopts = select({ - ":osx": [ + ":ios": [ "-framework Foundation", ], - ":ios": [ + ":osx": [ "-framework Foundation", ], "//conditions:default": [], diff --git a/absl/types/BUILD.bazel b/absl/types/BUILD.bazel index 6e287ce0..6dd4e142 100644 --- a/absl/types/BUILD.bazel +++ b/absl/types/BUILD.bazel @@ -14,6 +14,7 @@ # limitations under the License. # +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", diff --git a/absl/utility/BUILD.bazel b/absl/utility/BUILD.bazel index d41317e3..280a7dd5 100644 --- a/absl/utility/BUILD.bazel +++ b/absl/utility/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load( "//absl:copts/configure_copts.bzl", "ABSL_DEFAULT_COPTS", -- cgit v1.2.3