summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--MODULE.bazel57
-rw-r--r--WORKSPACE26
-rw-r--r--WORKSPACE.bzlmod35
-rw-r--r--ci/linux-presubmit.sh7
-rw-r--r--ci/macos-presubmit.sh1
-rw-r--r--ci/windows-presubmit.bat1
-rw-r--r--googletest_deps.bzl16
8 files changed, 122 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index fede02f..f0df39d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ bazel-genfiles
bazel-googletest
bazel-out
bazel-testlogs
+MODULE.bazel.lock
# python
*.pyc
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..d4ad2b3
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,57 @@
+# Copyright 2024 Google Inc.
+# All Rights Reserved.
+#
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# https://bazel.build/external/overview#bzlmod
+
+module(
+ name = "googletest",
+ version = "head",
+ compatibility_level = 1,
+)
+
+# Only direct dependencies need to be listed below.
+# Please keep the versions in sync with the versions in the WORKSPACE file.
+
+bazel_dep(name = "abseil-cpp",
+ version = "20240116.0",
+ repo_name = "com_google_absl")
+
+bazel_dep(name = "platforms",
+ version = "0.0.8")
+
+bazel_dep(name = "re2",
+ repo_name = "com_googlesource_code_re2",
+ version = "2023-11-01")
+
+bazel_dep(name = "rules_python",
+ version = "0.29.0")
+
+# https://github.com/bazelbuild/rules_python/blob/main/BZLMOD_SUPPORT.md#default-toolchain-is-not-the-local-system-python
+register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain")
diff --git a/WORKSPACE b/WORKSPACE
index f819ffe..92cfd25 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -6,22 +6,24 @@ googletest_deps()
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
- name = "rules_python", # 2023-07-31T20:39:27Z
- sha256 = "1250b59a33c591a1c4ba68c62e95fc88a84c334ec35a2e23f46cbc1b9a5a8b55",
- strip_prefix = "rules_python-e355becc30275939d87116a4ec83dad4bb50d9e1",
- urls = ["https://github.com/bazelbuild/rules_python/archive/e355becc30275939d87116a4ec83dad4bb50d9e1.zip"],
+ name = "rules_python",
+ sha256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580",
+ strip_prefix = "rules_python-0.29.0",
+ urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.29.0/rules_python-0.29.0.tar.gz"],
)
+# https://github.com/bazelbuild/rules_python/releases/tag/0.29.0
+load("@rules_python//python:repositories.bzl", "py_repositories")
+py_repositories()
+
http_archive(
- name = "bazel_skylib", # 2023-05-31T19:24:07Z
- sha256 = "08c0386f45821ce246bbbf77503c973246ed6ee5c3463e41efc197fa9bc3a7f4",
- strip_prefix = "bazel-skylib-288731ef9f7f688932bd50e704a91a45ec185f9b",
- urls = ["https://github.com/bazelbuild/bazel-skylib/archive/288731ef9f7f688932bd50e704a91a45ec185f9b.zip"],
+ name = "bazel_skylib",
+ sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
+ urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz"],
)
http_archive(
- name = "platforms", # 2023-07-28T19:44:27Z
- sha256 = "40eb313613ff00a5c03eed20aba58890046f4d38dec7344f00bb9a8867853526",
- strip_prefix = "platforms-4ad40ef271da8176d4fc0194d2089b8a76e19d7b",
- urls = ["https://github.com/bazelbuild/platforms/archive/4ad40ef271da8176d4fc0194d2089b8a76e19d7b.zip"],
+ name = "platforms",
+ sha256 = "8150406605389ececb6da07cbcb509d5637a3ab9a24bc69b1101531367d89d74",
+ urls = ["https://github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz"],
)
diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod
new file mode 100644
index 0000000..381432c
--- /dev/null
+++ b/WORKSPACE.bzlmod
@@ -0,0 +1,35 @@
+# Copyright 2024 Google Inc.
+# All Rights Reserved.
+#
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# https://bazel.build/external/migration#workspace.bzlmod
+#
+# This file is intentionally empty. When bzlmod is enabled and this
+# file exists, the content of WORKSPACE is ignored. This prevents
+# bzlmod builds from unintentionally depending on the WORKSPACE file.
diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh
index 1e05998..35e1670 100644
--- a/ci/linux-presubmit.sh
+++ b/ci/linux-presubmit.sh
@@ -67,6 +67,9 @@ for cc in /usr/local/bin/gcc /opt/llvm/clang/bin/clang; do
done
# Do one test with an older version of GCC
+# TODO(googletest-team): This currently uses Bazel 5. When upgrading to a
+# version of Bazel that supports Bzlmod, add --enable_bzlmod=false to keep test
+# coverage for the old WORKSPACE dependency management.
time docker run \
--volume="${GTEST_ROOT}:/src:ro" \
--workdir="/src" \
@@ -101,7 +104,7 @@ for std in ${STD}; do
--copt="-Wuninitialized" \
--copt="-Wundef" \
--define="absl=${absl}" \
- --enable_bzlmod=false \
+ --enable_bzlmod=true \
--features=external_include_paths \
--keep_going \
--show_timestamps \
@@ -126,7 +129,7 @@ for std in ${STD}; do
--copt="-Wuninitialized" \
--copt="-Wundef" \
--define="absl=${absl}" \
- --enable_bzlmod=false \
+ --enable_bzlmod=true \
--features=external_include_paths \
--keep_going \
--linkopt="--gcc-toolchain=/usr/local" \
diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh
index 1033282..70eaa74 100644
--- a/ci/macos-presubmit.sh
+++ b/ci/macos-presubmit.sh
@@ -69,6 +69,7 @@ for absl in 0 1; do
--copt="-Wundef" \
--cxxopt="-std=c++14" \
--define="absl=${absl}" \
+ --enable_bzlmod=true \
--features=external_include_paths \
--keep_going \
--show_timestamps \
diff --git a/ci/windows-presubmit.bat b/ci/windows-presubmit.bat
index 38565fb..9753f9c 100644
--- a/ci/windows-presubmit.bat
+++ b/ci/windows-presubmit.bat
@@ -51,6 +51,7 @@ SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
--compilation_mode=dbg ^
--copt=/std:c++14 ^
--copt=/WX ^
+ --enable_bzlmod=true ^
--keep_going ^
--test_output=errors ^
--test_tag_filters=-no_test_msvc2017
diff --git a/googletest_deps.bzl b/googletest_deps.bzl
index 8f19cbe..8958890 100644
--- a/googletest_deps.bzl
+++ b/googletest_deps.bzl
@@ -7,16 +7,16 @@ def googletest_deps():
if not native.existing_rule("com_googlesource_code_re2"):
http_archive(
- name = "com_googlesource_code_re2", # 2023-03-17T11:36:51Z
- sha256 = "cb8b5312a65f2598954545a76e8bce913f35fbb3a21a5c88797a4448e9f9b9d9",
- strip_prefix = "re2-578843a516fd1da7084ae46209a75f3613b6065e",
- urls = ["https://github.com/google/re2/archive/578843a516fd1da7084ae46209a75f3613b6065e.zip"],
+ name = "com_googlesource_code_re2",
+ sha256 = "828341ad08524618a626167bd320b0c2acc97bd1c28eff693a9ea33a7ed2a85f",
+ strip_prefix = "re2-2023-11-01",
+ urls = ["https://github.com/google/re2/releases/download/2023-11-01/re2-2023-11-01.zip"],
)
if not native.existing_rule("com_google_absl"):
http_archive(
- name = "com_google_absl", # 2023-09-13T14:58:42Z
- sha256 = "7766815ef6293dc7bca58fef59a96d7d3230874412dcd36dafb0e313ed1356f2",
- strip_prefix = "abseil-cpp-9e1789ffea47fdeb3133aa42aa9592f3673fb6ed",
- urls = ["https://github.com/abseil/abseil-cpp/archive/9e1789ffea47fdeb3133aa42aa9592f3673fb6ed.zip"],
+ name = "com_google_absl",
+ sha256 = "338420448b140f0dfd1a1ea3c3ce71b3bc172071f24f4d9a57d59b45037da440",
+ strip_prefix = "abseil-cpp-20240116.0",
+ urls = ["https://github.com/abseil/abseil-cpp/releases/download/20240116.0/abseil-cpp-20240116.0.tar.gz"],
)