Skip to content

Download Windows test tools and launchers instead of embedding them - #32632

Draft
fmeum wants to merge 3 commits into
bazelbuild:masterfrom
fmeum:prebuilt-windows-tools
Draft

fmeum wants to merge 3 commits into
bazelbuild:masterfrom
fmeum:prebuilt-windows-tools

Conversation

@fmeum

@fmeum fmeum commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The Windows test wrapper (tw.exe), the test XML writer (xml.exe), the launcher (launcher.exe) and the launcher maker are no longer embedded into @bazel_tools for the host platform only. Instead, @bazel_tools downloads them from per-platform archives, prebuilt_tools_<os>_<cpu>, defined next to remote_coverage_tools in tools/test/extensions.bzl. The Windows archives contain all four binaries, the macOS and Linux archives only the launcher maker. They are selected based on platforms rather than the host:

  • @bazel_tools//tools/test:test_wrapper and :xml_writer use the archive for the test's execution platform.
  • The launcher_toolchain_type toolchains provide launcher.exe for each Windows target platform. The launcher_maker_toolchain_type toolchains provide the launcher maker for each of the execution platforms listed below. Other execution platforms fall back to launcher_maker.sh, a POSIX shell script that produces the same output. //src/tools/launcher:launcher_maker_sh_test compares the two.

Repositories are only fetched when needed, so builds that neither target nor execute on Windows don't download anything. dummy.sh is now embedded on all hosts, which allows Windows hosts to run tests on other platforms.

The following are removed:

  • the toolchains that build the launcher and the launcher maker from source, together with their sources in @bazel_tools
  • the deprecated @bazel_tools//tools/launcher:launcher_maker target. rules_java and rules_python already use launcher_maker_toolchain_type on Bazel 9, and Use the launcher maker toolchain for Windows launchers bazel-contrib/rules_shell#79 does the same for rules_shell.
  • launcher_test.testBuildLaunchersWithClangClOnWindows, which built the launcher from @bazel_tools sources

src/prebuilt_tools/upload.sh builds the archive for one platform and uploads it to gs://bazel-mirror/bazel_prebuilt_tools/tmp/<commit>/. It is meant to run in a Buildkite pipeline on these platforms:

  • macOS arm64 and x86_64
  • Linux arm64 and x86_64 (Rocky Linux 8 for an old glibc)
  • Windows, plus Windows with --config=windows_arm64

src/prebuilt_tools/release.sh then promotes the archives and prints the version and hashes for tools/test/extensions.bzl. The shell and Python integration test harnesses override the host's archive with one built at the current commit, so changes to these tools are still covered by CI before a release.

This is a draft until:

Motivation

Fixes #19209

Also addresses the host-specific @bazel_tools contents mentioned in #19587.

Build API Changes

Yes

  1. Running a test on a Windows executor from a Linux host is not possible #19209
  2. No, @bazel_tools//tools/launcher:launcher_maker is removed.
  3. Use the @bazel_tools//tools/launcher:launcher_maker_toolchain_type toolchain, which is available since Bazel 8.3.0.

Release Notes

RELNOTES[INC]: @bazel_tools//tools/launcher:launcher_maker has been removed, use the @bazel_tools//tools/launcher:launcher_maker_toolchain_type toolchain instead. The Windows test wrapper and launcher are now downloaded rather than embedded, so Windows tests can run and Windows launchers can be built from any host.

The Windows test wrapper, the test XML writer, the launcher and the
launcher maker are now downloaded from per-platform archives built on
Bazel CI rather than embedded into `@bazel_tools` for the host platform
only. They are selected based on the execution and target platforms, so
Windows tests can run and Windows launchers can be built from any host.

The toolchains that build the launcher and the launcher maker from
source and the deprecated `@bazel_tools//tools/launcher:launcher_maker`
target are removed.
Execution platforms without a prebuilt launcher maker resolved the no-op
toolchain, so building a Windows launcher on them failed. They now use
`launcher_maker.sh`, which produces the same output as `launcher_maker.cc` and
only requires a POSIX shell.
shasum isn't available on all Linux images.
fmeum added a commit to bazel-contrib/rules_shell that referenced this pull request Nov 16, 2026
`sh_binary` and `sh_test` now get the launcher maker from the
`@bazel_tools//tools/launcher:launcher_maker_toolchain_type` toolchain,
as rules_java already does, instead of the deprecated
`@bazel_tools//tools/launcher:launcher_maker` target, which
bazelbuild/bazel#32632 removes. The `launcher_maker` attribute of
`sh_toolchain` is now a no-op.

The rules also opt into automatic exec groups, as the rules_java rules
do. The execution platform of the launcher action is then selected for
the launcher maker toolchain alone, independently of the shell
toolchain, and `exec_properties` can target it with the
`@@bazel_tools//tools/launcher:launcher_maker_toolchain_type.` prefix.

The toolchain type exists in Bazel 8.3.0 and later, which covers all
versions that use the Starlark rules by default.

Work towards bazelbuild/bazel#19209

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running a test on a Windows executor from a Linux host is not possible

1 participant