From 6fd262ecf787d0dc2a91696fd4bf1d3ee1ebfa14 Mon Sep 17 00:00:00 2001 From: Yannic Bonenberger Date: Wed, 7 Aug 2019 17:04:29 +0200 Subject: Prepare for Bazel incompatible changes Fixes googletest for upcoming `--incompatible_load_cc_rules_from_bzl` (https://github.com/bazelbuild/bazel/issues/8743) and `--incompatible_load_python_rules_from_bzl` (https://github.com/bazelbuild/bazel/issues/9006). This change was automatically generated with `buildifier -lint=fix -warnings=all $(find . -name "BUILD" -o -name "BUILD.bazel" -o -name "*.bzl")`. --- BUILD.bazel | 18 ++++++++++-------- WORKSPACE | 18 +++++++++++++++--- googlemock/test/BUILD.bazel | 3 +++ googletest/test/BUILD.bazel | 3 +++ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index f0c4ce5..9b48aee 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -30,6 +30,8 @@ # # Bazel Build for Google C++ Testing Framework(Google Test) +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") + package(default_visibility = ["//visibility:public"]) licenses(["notice"]) @@ -81,6 +83,10 @@ cc_library( ":has_absl": ["GTEST_HAS_ABSL=1"], "//conditions:default": [], }), + features = select({ + ":windows": ["windows_export_all_symbols"], + "//conditions:default": [], + }), includes = [ "googlemock", "googlemock/include", @@ -102,20 +108,16 @@ cc_library( ], "//conditions:default": [], }), - features = select({ - ":windows": ["windows_export_all_symbols"], - "//conditions:default": [], - }) ) cc_library( name = "gtest_main", srcs = ["googlemock/src/gmock_main.cc"], - deps = [":gtest"], features = select({ ":windows": ["windows_export_all_symbols"], "//conditions:default": [], - }) + }), + deps = [":gtest"], ) # The following rules build samples of how to use gTest. @@ -136,7 +138,7 @@ cc_library( features = select({ ":windows": ["windows_export_all_symbols"], "//conditions:default": [], - }) + }), ) cc_test( @@ -155,11 +157,11 @@ cc_test( "googletest/samples/sample7_unittest.cc", "googletest/samples/sample8_unittest.cc", ], + linkstatic = 0, deps = [ "gtest_sample_lib", ":gtest_main", ], - linkstatic = 0, ) cc_test( diff --git a/WORKSPACE b/WORKSPACE index b69578b..7eb7219 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,7 +4,19 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Abseil http_archive( - name = "com_google_absl", - urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], - strip_prefix = "abseil-cpp-master", + name = "com_google_absl", + strip_prefix = "abseil-cpp-master", + urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], +) + +http_archive( + name = "rules_cc", + strip_prefix = "rules_cc-master", + urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"], +) + +http_archive( + name = "rules_python", + strip_prefix = "rules_python-master", + urls = ["https://github.com/bazelbuild/rules_python/archive/master.zip"], ) diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index e74102f..da95ed5 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel @@ -32,6 +32,9 @@ # # Bazel Build for Google C++ Testing Framework(Google Test)-googlemock +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test") +load("@rules_python//python:defs.bzl", "py_library", "py_test") + licenses(["notice"]) # Tests for GMock itself diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 45dff30..156d5d4 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -32,6 +32,9 @@ # # Bazel BUILD for The Google C++ Testing Framework (Google Test) +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test") +load("@rules_python//python:defs.bzl", "py_library", "py_test") + licenses(["notice"]) #on windows exclude gtest-tuple.h -- cgit v0.12 From 800c9b30168f2167776d729759bf90122c987e35 Mon Sep 17 00:00:00 2001 From: Yannic Bonenberger Date: Wed, 7 Aug 2019 17:50:31 +0200 Subject: Update Bazel on Windows --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6ef08fd..a58b768 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,7 +58,7 @@ install: # install Bazel if ($env:build_system -eq "bazel") { - appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-windows-x86_64.exe -FileName bazel.exe + appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.28.1/bazel-0.28.1-windows-x86_64.exe -FileName bazel.exe } if ($env:build_system -eq "cmake") { -- cgit v0.12