summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2024-07-30 20:17:08 (GMT)
committerCopybara-Service <copybara-worker@google.com>2024-07-30 20:17:40 (GMT)
commit3e3b44c300b21eb996a2957782421bc0f157af18 (patch)
treeb7cbba148ec43ea5649f5470bd585283b1e698b8
parentffa31aec1cbbe0d18398647c0bc3292b4af5efbf (diff)
downloadgoogletest-3e3b44c300b21eb996a2957782421bc0f157af18.zip
googletest-3e3b44c300b21eb996a2957782421bc0f157af18.tar.gz
googletest-3e3b44c300b21eb996a2957782421bc0f157af18.tar.bz2
Remove auto-detection of Python toolchain from MODULE.bazel
since it affects downstream users The correct solution appears to be https://rules-python.readthedocs.io/en/stable/toolchains.html#library-modules-with-dev-only-python-usage This change also includes a workaround for the new mechanism creating paths that are too long for Windows to handle. Fixes #4581 PiperOrigin-RevId: 657706984 Change-Id: I8ae6b9e5efeb7629d79d14e7d4d3889876282d17
-rw-r--r--MODULE.bazel16
-rw-r--r--ci/windows-presubmit.bat7
2 files changed, 18 insertions, 5 deletions
diff --git a/MODULE.bazel b/MODULE.bazel
index 8df73fb..c9a52e0 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -49,11 +49,19 @@ bazel_dep(name = "re2",
version = "2024-07-02")
bazel_dep(name = "rules_python",
- version = "0.29.0")
+ version = "0.34.0",
+ dev_dependency = True)
+# https://rules-python.readthedocs.io/en/stable/toolchains.html#library-modules-with-dev-only-python-usage
+python = use_extension(
+ "@rules_python//python/extensions:python.bzl",
+ "python",
+ dev_dependency = True
+)
+
+python.toolchain(python_version = "3.12",
+ is_default = True,
+ ignore_root_user_error = True)
fake_fuchsia_sdk = use_repo_rule("//:fake_fuchsia_sdk.bzl", "fake_fuchsia_sdk")
fake_fuchsia_sdk(name = "fuchsia_sdk")
-
-# 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/ci/windows-presubmit.bat b/ci/windows-presubmit.bat
index 9753f9c..1adc1a1 100644
--- a/ci/windows-presubmit.bat
+++ b/ci/windows-presubmit.bat
@@ -46,8 +46,13 @@ RMDIR /S /Q cmake_msvc2022
:: ----------------------------------------------------------------------------
:: Bazel
+:: The default home directory on Kokoro is a long path which causes errors
+:: because of Windows limitations on path length.
+:: --output_user_root=C:\tmp causes Bazel to use a shorter path.
SET BAZEL_VS=C:\Program Files\Microsoft Visual Studio\2022\Community
-%BAZEL_EXE% test ... ^
+%BAZEL_EXE% ^
+ --output_user_root=C:\tmp ^
+ test ... ^
--compilation_mode=dbg ^
--copt=/std:c++14 ^
--copt=/WX ^