Add support for Bzlmod for the next release
https://bazel.build/external/overview#bzlmod Bzlmod will be the default in a future Bazel release. By default it requires projects to be registered with the Bazel Central Registry (https://registry.bazel.build/) and thus uses regular releases by default. Users that want to "live-at-head" can still do this through with overrides (https://bazel.build/external/module#overrides). This change updates GoogleTest dependencies to use released versions. CI uses Bzlmod except in the case of linux_gcc-floor, which will keep testing the old WORKSPACE-based dependency system. PiperOrigin-RevId: 601489729 Change-Id: I6be52034eba0d0e5fe12110e5e82879305cf73ff
This commit is contained in:
		 Derek Mauro
					Derek Mauro
				
			
				
					committed by
					
						 Copybara-Service
						Copybara-Service
					
				
			
			
				
	
			
			
			 Copybara-Service
						Copybara-Service
					
				
			
						parent
						
							563ebf1769
						
					
				
				
					commit
					6a5938233b
				
			
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -8,6 +8,7 @@ bazel-genfiles | ||||
| bazel-googletest | ||||
| bazel-out | ||||
| bazel-testlogs | ||||
| MODULE.bazel.lock | ||||
| # python | ||||
| *.pyc | ||||
|  | ||||
|   | ||||
							
								
								
									
										57
									
								
								MODULE.bazel
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								MODULE.bazel
									
									
									
									
									
										Normal file
									
								
							| @@ -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") | ||||
							
								
								
									
										32
									
								
								WORKSPACE
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								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", | ||||
|   sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94", | ||||
|   urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz"], | ||||
| ) | ||||
|  | ||||
| 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"], | ||||
| ) | ||||
|  | ||||
| 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"], | ||||
| ) | ||||
|   | ||||
							
								
								
									
										35
									
								
								WORKSPACE.bzlmod
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								WORKSPACE.bzlmod
									
									
									
									
									
										Normal file
									
								
							| @@ -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. | ||||
| @@ -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" \ | ||||
|   | ||||
| @@ -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 \ | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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"], | ||||
|         ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user