@@ -3,17 +3,19 @@ load("//ruby/private/toolchains:repository_context.bzl", "ruby_repository_contex
33
44def _install_ruby_version (ctx , version ):
55 ctx .download_and_extract (
6- url = "https://github.com/rbenv/ruby-build/archive/refs/tags/v20220218 .tar.gz" ,
7- sha256 = "35c82b13b7bc3713eee5615b0145c79fbbac32873f55f2ab796620d76970d8e3 " ,
8- stripPrefix = "ruby-build-20220218 " ,
6+ url = "https://github.com/rbenv/ruby-build/archive/refs/tags/v20220825 .tar.gz" ,
7+ sha256 = "55d9363a27486e4ec9623985d7764c5cf8e59cafe58afcf666e81fa148dea2f0 " ,
8+ stripPrefix = "ruby-build-20220825 " ,
99 )
1010
1111 install_path = "./build"
12- ctx .execute (
12+ result = ctx .execute (
1313 ["./bin/ruby-build" , "--verbose" , version , install_path ],
1414 quiet = False ,
1515 timeout = 1600 , # massive timeout because this does a lot and is a beast
1616 )
17+ if result .return_code :
18+ fail ("Ruby build failed: %s %s" % (result .stdout , result .stderr ))
1719
1820def _is_subpath (path , ancestors ):
1921 """Determines if path is a subdirectory of one of the ancestors"""
@@ -107,6 +109,9 @@ def host_ruby_is_correct_version(ctx, version):
107109 return False
108110
109111 ruby_version = ctx .execute (["ruby" , "-e" , "print RUBY_VERSION" ]).stdout
112+ ruby_platform = ctx .execute (["ruby" , "-e" , "print RUBY_PLATFORM" ]).stdout
113+ if ruby_platform == "java" :
114+ ruby_version = "jruby-" + ruby_version
110115
111116 have_ruby_version = (version == ruby_version )
112117
@@ -124,7 +129,7 @@ def _ruby_runtime_impl(ctx):
124129 _install_ruby_version (ctx , version )
125130 interpreter_path = ctx .path ("./build/bin/ruby" )
126131
127- if not interpreter_path :
132+ if not interpreter_path or not interpreter_path . exists :
128133 fail (
129134 "Command 'ruby' not found. Set $PATH or specify interpreter_path" ,
130135 "interpreter_path" ,
0 commit comments