Skip to content

fix(toolchains): register native_build_toolchain per exec/target platform for sdist builds#928

Merged
jbedard merged 3 commits intomainfrom
greg/native-build-toolchain-public
Apr 8, 2026
Merged

fix(toolchains): register native_build_toolchain per exec/target platform for sdist builds#928
jbedard merged 3 commits intomainfrom
greg/native-build-toolchain-public

Conversation

@gregmagolan
Copy link
Copy Markdown
Member

@gregmagolan gregmagolan commented Apr 7, 2026

Problem

native_build_toolchain (used by pep517_whl for sdist builds) was not registered with @rules_py_tools//:all and it was a single static toolchain with use_target_platform_constraints = True. This only matches when exec == target, but Bazel needs one registered entry per exec platform so it can resolve native_build_toolchain_type for each build host.

Fix

Generate one native_build_toolchain entry per exec platform in toolchains_repo (repo.bzl), so they land in @rules_py_tools//:all which is already registered by all users.

native_build_toolchain_type now resolves automatically on all supported exec platforms via the existing register_toolchains("@rules_py_tools//:all").

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows bot commented Apr 7, 2026

Bazel 8 (Test)

All tests were cache hits

113 tests (100.0%) were fully cached saving 56s.


Bazel 9 (Test)

All tests were cache hits

112 tests (100.0%) were fully cached saving 60s.


Bazel 8 (Test)

e2e

All tests were cache hits

52 tests (100.0%) were fully cached saving 40s.


Bazel 9 (Test)

e2e

All tests were cache hits

52 tests (100.0%) were fully cached saving 60s.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 444ms.


Buildifier

@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from 98e540c to 4763211 Compare April 8, 2026 00:01
@gregmagolan gregmagolan changed the title fix(toolchain): expose native_build_toolchain at a public path fix(pep517_whl): register native_build_toolchain per exec/target platform for sdist builds Apr 8, 2026
@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from 4763211 to e50ea58 Compare April 8, 2026 00:06
@gregmagolan gregmagolan changed the title fix(pep517_whl): register native_build_toolchain per exec/target platform for sdist builds fix(toolchains): register native_build_toolchain per exec/target platform for sdist builds Apr 8, 2026
@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from b5eabf0 to 4e43f34 Compare April 8, 2026 00:30
@jbedard
Copy link
Copy Markdown
Member

jbedard commented Apr 8, 2026

Can a test be added showing what is being fixed?

@gregmagolan
Copy link
Copy Markdown
Member Author

Can a test be added showing what is being fixed?

In theory yes, but not without setting up some additional platforms on RBE.

@gregmagolan
Copy link
Copy Markdown
Member Author

Actually, we if we add an sdist dep to e2e then we'd test that the toolchain is registered properly on at least one platform. I'll update.

@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from f89c0ac to 0a11fdf Compare April 8, 2026 20:57
@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from 0a11fdf to 5606a32 Compare April 8, 2026 20:57
@gregmagolan gregmagolan force-pushed the greg/native-build-toolchain-public branch from 5606a32 to dcc05d3 Compare April 8, 2026 21:20
@jbedard jbedard enabled auto-merge (squash) April 8, 2026 22:22
@jbedard jbedard merged commit 4e64781 into main Apr 8, 2026
3 checks passed
@jbedard jbedard deleted the greg/native-build-toolchain-public branch April 8, 2026 22:34
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.

2 participants