Skip to content

Commit

Permalink
Use override Ruby toolchain consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
sushain97 committed Jul 23, 2024
1 parent 8b542cd commit 905c0cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ruby/private/binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def rb_binary_impl(ctx):
transitive_srcs = get_transitive_srcs(ctx.files.srcs, ctx.attr.deps).to_list()

ruby_toolchain = ctx.toolchains["@rules_ruby//ruby:toolchain_type"]
if ctx.attr.ruby != None:
ruby_toolchain = ctx.attr.ruby[platform_common.ToolchainInfo]
tools = [ctx.file._runfiles_library]
tools.extend(ruby_toolchain.files)

Expand Down
4 changes: 4 additions & 0 deletions ruby/private/gem_build.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"Implementation details for rb_gem_build"

load("//ruby/private:binary.bzl", BINARY_ATTRS = "ATTRS")
load("//ruby/private:library.bzl", LIBRARY_ATTRS = "ATTRS")
load(
"//ruby/private:providers.bzl",
Expand All @@ -20,6 +21,8 @@ def _rb_gem_build_impl(ctx):
bundle_env = get_bundle_env({}, ctx.attr.deps)
java_toolchain = ctx.toolchains["@bazel_tools//tools/jdk:runtime_toolchain_type"]
ruby_toolchain = ctx.toolchains["@rules_ruby//ruby:toolchain_type"]
if ctx.attr.ruby != None:
ruby_toolchain = ctx.attr.ruby[platform_common.ToolchainInfo]
tools = []
tools.extend(ruby_toolchain.files)

Expand Down Expand Up @@ -97,6 +100,7 @@ rb_gem_build = rule(
_rb_gem_build_impl,
attrs = dict(
LIBRARY_ATTRS,
ruby = BINARY_ATTRS["ruby"],
gemspec = attr.label(
allow_single_file = [".gemspec"],
mandatory = True,
Expand Down
2 changes: 2 additions & 0 deletions ruby/private/gem_push.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def _rb_gem_push_impl(ctx):
env = {}
java_toolchain = ctx.toolchains["@bazel_tools//tools/jdk:runtime_toolchain_type"]
ruby_toolchain = ctx.toolchains["@rules_ruby//ruby:toolchain_type"]
if ctx.attr.ruby != None:
ruby_toolchain = ctx.attr.ruby[platform_common.ToolchainInfo]
srcs = [ctx.file.gem]
tools = [ruby_toolchain.gem, ctx.file._runfiles_library]

Expand Down

0 comments on commit 905c0cb

Please sign in to comment.