Skip to content

feat: multi-platform portable-ruby toolchains#377

Merged
p0deje merged 9 commits into
mainfrom
feat/toolchains
Jun 3, 2026
Merged

feat: multi-platform portable-ruby toolchains#377
p0deje merged 9 commits into
mainfrom
feat/toolchains

Conversation

@p0deje
Copy link
Copy Markdown
Member

@p0deje p0deje commented Jun 2, 2026

Replaces the single-platform @ruby repo (downloaded for the Bazel client's host) with proper Bazel toolchain resolution across {x86_64,arm64}_linux and {x86_64,arm64}_darwin when portable_ruby = True. Per-platform repositories are lazily fetched and registered as separate toolchain() entries with exec_compatible_with constraints.

A new hub repo at @ruby aliases the canonical targets (:bundle, :gem, :ruby, :headers, :jars, :dist_files, etc.) via select() so existing references like @ruby//:bundle keep working. This unblocks remote execution (EngFlow, BuildBuddy RBE) where the client and exec platforms differ. Activated automatically when portable_ruby = True.

JRuby remains a fully cross-platform toolchain without any constraints.
ruby-build/TruffleRuby/RubyInstaller/system remain single-platform.

@p0deje p0deje force-pushed the feat/toolchains branch from d3050ec to 07c74c7 Compare June 2, 2026 15:52
@p0deje p0deje requested a review from sushain97 June 2, 2026 16:31
@p0deje p0deje marked this pull request as ready for review June 2, 2026 16:31
Copy link
Copy Markdown
Collaborator

@sushain97 sushain97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Comment thread ruby/private/toolchain/hub.bzl Outdated
def _emit_alias(name, hub_name, platforms):
branches = []
for plat in platforms:
branches.append(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we build up branches as a dict and then use repr below to minimize the manual formatting?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like to see properly formatted BUILD files, even if we autogenerate them. I've cleaned up the implementation to use templates and the existing join_and_indent utility function, though. It looks like this now https://gist.github.com/p0deje/8a7c7a6ba59c906ab181ef59587c8044.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@p0deje p0deje merged commit e43f4eb into main Jun 3, 2026
56 checks passed
@p0deje p0deje deleted the feat/toolchains branch June 3, 2026 19:14
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