Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support per-target Ruby toolchain #140

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Support per-target Ruby toolchain #140

merged 1 commit into from
Jul 16, 2024

Conversation

sushain97
Copy link
Collaborator

@sushain97 sushain97 commented Jul 16, 2024

Allow customizing the Ruby toolchain used when building the bundle/running test targets and bundled with executables. This is necessary for environments where there are multiple Ruby versions in the same Bazel workspace. At Stripe, we even ship some artifacts that are built using multiple versions of Ruby, e.g. during a migration.

@sushain97 sushain97 requested a review from p0deje July 16, 2024 00:55
@p0deje
Copy link
Member

p0deje commented Jul 16, 2024

Is it possible to register multiple Ruby toolchains? I was under the impression that it's not currently working #22 (comment)

@sushain97
Copy link
Collaborator Author

Is it possible to register multiple Ruby toolchains? I was under the impression that it's not currently working #22 (comment)

Er, I'm not attempting it.

It's possible to declare the toolchain and then use it as necessary. In some environments, you could wrap every ruby_test with your own macro that selects the correct toolchain.

Right now, we have:

rb_download(
    name = "ruby",
    version_file = "//:.ruby-version",
)

rb_download(
    name = "ruby_foo",
    version_file = "//foo:.ruby-version",
)

native.register_toolchains("//tools/ruby:ruby_toolchains")

rb_bundle_fetch(
    name = "bundle",
    # ...
)

rb_bundle_fetch(
    name = "foo_bundle",
    ruby = "@ruby_foo//:toolchain",
    # ...
)

@p0deje p0deje merged commit dd99181 into main Jul 16, 2024
41 checks passed
@p0deje p0deje deleted the add-ruby-attr branch July 16, 2024 15:52
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