Skip to content

build: stop registering unused Go toolchains and loading rules_py's platform package (#9203) - #9303

Closed
TrapsterDK wants to merge 2 commits into
mainfrom
issue-9203-toolchain-patches
Closed

TrapsterDK wants to merge 2 commits into
mainfrom
issue-9203-toolchain-patches

Conversation

@TrapsterDK

Copy link
Copy Markdown
Collaborator

Part of #9203. This is a speed experiment. It is kept only if the evidence pairs show at least 2s saved.

rules_go (patches/rules_go/root_sdks_only.patch): when the root module declares Go SDKs with download, from_file, wrap or host, toolchains from other modules' go_sdk tags are no longer registered. Their SDK repos are still created, so use_repo keeps working. @go_toolchains drops from 54 declare_bazel_toolchains calls to 6. Before this change, the 48 extra toolchains were registered after ours and never picked. Upstream: bazel-contrib/rules_go#4779.

rules_py (patches/rules_py/platform_flags_package.patch): platform_libc and platform_version move to //uv/private/constraints/platform/flags, and the old labels become aliases. The interpreter toolchain config_settings, defs.bzl, the PEP 517 frontend transition and pep517_native_whl now use the new labels. Toolchain resolution no longer loads //uv/private/constraints/platform. Upstream: aspect-build/rules_py#1675.

Local checks (linux_x86_64)

  • bazel test //cli/process/... //go/tools/modfmt:modfmt_test //python/tests/fixtures/hello:hello_test: 4 tests pass.
  • cquery deps(//python/tests/fixtures/hello:hello_test):
    • by default, it picks @python_3_12_x86_64_unknown_linux_gnu;
    • with --@rules_py//uv/private/constraints/platform:platform_libc=musl (the alias) or with the new .../flags:platform_libc=musl, it picks python_3_12_x86_64_unknown_linux_musl.
  • --profile of build --nobuild //cli/process/... on a fresh server:
    • @@rules_py+//uv/private/constraints/platform: no longer loaded (only .../flags, 1 ms);
    • @@rules_go++go_sdk+go_toolchains// package creation: 33 ms, compared with 123 ms for @@llvm+//toolchain in the same run.
  • Nested-Bazel and *_consumer_test targets were not run.

Remaining

  • Refresh the other platforms' entries in MODULE.bazel.lock with lock-refresh.
  • Evidence pairs on linux_x86_64 and windows_x86_64 (main vs branch).
  • If it pays, add the OVERRIDES rules_py patch and a rules_go row in cli/adopt/src/overrides.rs, update the patches/README.md rows and run tools/dx init --apply in families/*.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hzpb4qWNZKpDCrwUz7

TrapsterDK and others added 2 commits November 7, 2026 13:55
…latform package (#9203)

rules_go: when the root module declares its own Go SDKs, toolchains from
other modules' go_sdk tags are no longer registered. Their SDK repos are
still created, so their use_repo names keep working. @go_toolchains drops
from 54 declare_bazel_toolchains calls to 6.

rules_py: the platform_libc and platform_version string_flags move to
//uv/private/constraints/platform/flags. The old labels stay as aliases.
The interpreter toolchains' config_settings now point at the small
package, so toolchain resolution no longer loads
//uv/private/constraints/platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hzpb4qWNZKpDCrwUz7
Taken from the merged artifact of lock-refresh run 42374657201, whose push was refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hzpb4qWNZKpDCrwUz7
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Dropped: it is about 16s slower on windows_x86_64 over two evidence pairs, but 4s faster on linux_x86_64. The numbers are on #9203 and #8912.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hzpb4qWNZKpDCrwUz7

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.

1 participant