From f3764a141ad3b622dc0604039dadcbf0bfe9a5de Mon Sep 17 00:00:00 2001 From: ksss Date: Tue, 29 Sep 2026 23:13:52 +0900 Subject: [PATCH] Pass rbs.gemspec by path to Jars::Installer in wasm:install_jars jar-dependencies 0.6 (bundled with JRuby 10.1.2.0) writes its temporary deps.lst with File.open into the installer's basedir. For a loaded Gem::Specification the basedir is spec.gem_dir, which for a checkout is a nonexistent ../gems/rbs-*-java directory, so the task fails with ENOENT. jar-dependencies 0.5.x only worked because Maven created that directory. Pass the gemspec path instead so the basedir is the checkout, and let the gemspec stamp the java platform via RBS_PLATFORM=java. Co-Authored-By: Claude Opus 5.5 --- Rakefile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 2316ac4aa..883fa4ae6 100644 --- a/Rakefile +++ b/Rakefile @@ -991,14 +991,24 @@ namespace :wasm do task :install_jars do # Resolves the `jar` requirements from rbs.gemspec via Maven and downloads # them (and their transitive deps) into ~/.m2, the same way `gem install` - # does; the jars are not copied into the gem. The platform is forced to java - # because Jars::Installer skips non-java gems, and write_require_file is false - # because lib/rbs_jars.rb is hand-maintained (the generator mangles the - # `com.dylibso.chicory:runtime` artifact id). + # does; the jars are not copied into the gem. RBS_PLATFORM=java makes the + # gemspec stamp the java platform because Jars::Installer skips non-java + # gems, and write_require_file is false because lib/rbs_jars.rb is + # hand-maintained (the generator mangles the `com.dylibso.chicory:runtime` + # artifact id). + # + # The gemspec is passed as a path, not a loaded Gem::Specification: for the + # latter jar-dependencies works in `spec.gem_dir`, which for a checkout is a + # nonexistent `../gems/rbs-*-java` directory, and jar-dependencies >= 0.6 + # (JRuby >= 10.1.2.0) fails to write its temporary deps.lst there. require "jars/installer" - spec = Gem::Specification.load("rbs.gemspec") - spec.platform = "java" - Jars::Installer.new(spec).install_jars(write_require_file: false) + platform, ENV["RBS_PLATFORM"] = ENV["RBS_PLATFORM"], "java" + begin + installer = Jars::Installer.new(File.expand_path("rbs.gemspec", __dir__)) + ensure + ENV["RBS_PLATFORM"] = platform + end + installer.install_jars(write_require_file: false) end desc "Build rbs_parser.wasm and copy it next to RBS::WASM::Runtime"