Skip to content

ruby: own the Ruby toolchain type so registering it does not fetch rules_ruby - #14985

Merged
TrapsterDK merged 1 commit into
mainfrom
lazy-ruby-toolchain-type
Nov 28, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
lazy-ruby-toolchain-type

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Every consumer fetched the rules_ruby archive and @dx_ruby_toolchains, even without Ruby targets, because register_toolchains("@dx_ruby_toolchains//:all") registered toolchains whose type is @rules_ruby//ruby:toolchain_type.

Follows #14981 (same approach for .NET); it reuses that PR's hub_order_test toolchain_types check.

  • //ruby:toolchain_type is a new rules_dx toolchain type. The new ruby/private/toolchains.BUILD.bazel is the @dx_toolchains//ruby package: six gated toolchain() targets of that type, pointing at @dx_ruby_toolchains//:<platform>. MODULE.bazel registers @dx_toolchains//ruby:all instead of @dx_ruby_toolchains//:all.
  • patches/rules_ruby/toolchain_aliases.patch is feat: alias each platform's toolchain in the proxy repository bazel-contrib/rules_ruby#452: the proxy repo also emits one alias() per platform, so a module can declare its own toolchain() targets.
  • patches/rules_ruby/toolchain_type_alias.patch makes @rules_ruby//ruby:toolchain_type an alias of ours, so rules_ruby's rules and the rules_dx rules that request the upstream label resolve the same toolchains.
  • toolchains_gate.patch is gone: the proxy's own toolchain() targets are no longer registered, and ours carry //config:toolchains_on.
  • @dx_hub_builds and the hub_builds repository rule are gone. hub_order_test reads the hub file directly.
  • ruby_coverage stays in ruby/extensions.bzl, which loads rules_ruby. The extension only runs when one of its repos is needed, so it doesn't make consumers fetch rules_ruby.
  • rules_dx++dx_pins+rules_ruby and rules_dx++ruby+dx_ruby_toolchains leave the go, java, java_check and rust cold-start lists. rules_ruby is a FOREIGN fragment for go, java and rust.
  • external_repos budgets go down by two each (core 227, python 230 / 241). These numbers are predicted; CI measures them.
  • api/labels.txt and docs/supported-surface.md list the new type.

Upstream: bazel-contrib/rules_ruby#451 (issue), bazel-contrib/rules_ruby#452 (PR). The type alias patch stays rules_dx only: the type has to live outside the rules_ruby repo for the repo to go unfetched.

No local build or test was run (builder cap). CI and /evidence on this PR do the verification.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hvdpJxYihWhnWtH8yv

…les_ruby

The rules_dx extension still creates @dx_ruby_toolchains, but rules_dx now
registers its own toolchain() targets from @dx_toolchains//ruby, typed by
//ruby:toolchain_type and pointing at the per-platform aliases that
bazel-contrib/rules_ruby#452 adds to the proxy repo. rules_ruby's
//ruby:toolchain_type becomes an alias of ours, so its rules still resolve.
The gate patch and the dx_hub_builds copy of the proxy BUILD are no longer
needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hvdpJxYihWhnWtH8yv
@TrapsterDK
TrapsterDK force-pushed the lazy-ruby-toolchain-type branch from 41799c3 to aa5629b Compare November 28, 2026 10:56
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

/evidence platforms=["linux_x86_64"] task=test scope=//tools/testing/consumer:network_test

@TrapsterDK
TrapsterDK merged commit 1ff3e0f into main Nov 28, 2026
9 of 18 checks passed
@TrapsterDK
TrapsterDK deleted the lazy-ruby-toolchain-type branch November 28, 2026 11:10
@github-actions

Copy link
Copy Markdown
Contributor

/evidence could not dispatch evidence.yml on lazy-ruby-toolchain-type.

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