-
Notifications
You must be signed in to change notification settings - Fork 249
Fetch Chicory/ASM jars from Maven instead of bundling in gem #3019
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
base: master
Are you sure you want to change the base?
Changes from all commits
a5d9071
baf70dc
38446c5
46c8ddc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # frozen_string_literal: true | ||
| # | ||
| # Loads the Chicory/ASM jars for the JRuby WebAssembly parser (RBS::WASM::Runtime) | ||
| # from the local Maven repository. Hand-maintained, NOT auto-generated: the | ||
| # jar-dependencies generator mangles the `com.dylibso.chicory:runtime` artifact id | ||
| # into `jar` (its artifact name collides with a Maven scope keyword). Leaving out | ||
| # the usual "this is a generated file" marker also stops jar-dependencies from | ||
| # overwriting this file at gem install. Keep this list in sync with the `jar` | ||
| # requirements in rbs.gemspec. | ||
| require "jar_dependencies" | ||
|
|
||
| require_jar "com.dylibso.chicory", "wasm", "1.7.5" | ||
| require_jar "com.dylibso.chicory", "runtime", "1.7.5" | ||
| require_jar "com.dylibso.chicory", "log", "1.7.5" | ||
| require_jar "com.dylibso.chicory", "wasi", "1.7.5" | ||
| require_jar "com.dylibso.chicory", "compiler", "1.7.5" | ||
| require_jar "org.ow2.asm", "asm", "9.9.1" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only top-level dependencies are required here; jar-dependencies will load any transitive dependencies necessary. I believe only |
||
| require_jar "org.ow2.asm", "asm-tree", "9.9.1" | ||
| require_jar "org.ow2.asm", "asm-util", "9.9.1" | ||
| require_jar "org.ow2.asm", "asm-commons", "9.9.1" | ||
| require_jar "org.ow2.asm", "asm-analysis", "9.9.1" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,18 +38,37 @@ Gem::Specification.new do |spec| | |
|
|
||
| # JRuby cannot load the MRI C extension. On JRuby (and in the `java` platform | ||
| # gem, built with RBS_PLATFORM=java) RBS runs the WebAssembly-backed parser, so | ||
| # ship the prebuilt parser and the Chicory jars (assembled by | ||
| # `rake wasm:jruby_setup`) and skip the C extension. | ||
| # ship the prebuilt parser (built by `rake wasm:build`) and skip the C | ||
| # extension. The Chicory/ASM jars the runtime needs are NOT shipped in the gem: | ||
| # they are declared as `jar-dependencies` requirements below and fetched from | ||
| # Maven Central at install time (see lib/rbs/wasm/jars.rb). | ||
| building_java_gem = ENV["RBS_PLATFORM"] == "java" | ||
| on_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" | ||
|
|
||
| if building_java_gem || on_jruby | ||
| # Only stamp the platform when building the release gem; leave it unset for | ||
| # local development on JRuby so it still matches a `ruby` platform lockfile. | ||
| spec.platform = "java" if building_java_gem | ||
| # rbs_parser.wasm is a build artifact (not tracked in git), so add it | ||
| # explicitly. lib/rbs_jars.rb is committed, so git ls-files already has it. | ||
| spec.files += Dir.chdir(File.expand_path('..', __FILE__)) do | ||
| Dir.glob("lib/rbs/wasm/rbs_parser.wasm") + Dir.glob("lib/rbs/wasm/jars/*.jar") | ||
| Dir.glob("lib/rbs/wasm/rbs_parser.wasm") | ||
| end | ||
|
|
||
| # jar-dependencies (bundled with JRuby) downloads these jars from Maven when | ||
| # the gem is installed, keeping the gem small and avoiding conflicting copies. | ||
| # lib/rbs_jars.rb require_jars them at runtime; keep the two lists in sync. | ||
| spec.add_dependency "jar-dependencies", ">= 0.1.7" | ||
| spec.requirements << "jar com.dylibso.chicory:wasm, 1.7.5" | ||
| spec.requirements << "jar com.dylibso.chicory:runtime, 1.7.5" | ||
| spec.requirements << "jar com.dylibso.chicory:log, 1.7.5" | ||
| spec.requirements << "jar com.dylibso.chicory:wasi, 1.7.5" | ||
| spec.requirements << "jar com.dylibso.chicory:compiler, 1.7.5" | ||
| spec.requirements << "jar org.ow2.asm:asm, 9.9.1" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only need These dependencies are also being duplicated multiple places despite Claude saying that the jars file is the master list. |
||
| spec.requirements << "jar org.ow2.asm:asm-tree, 9.9.1" | ||
| spec.requirements << "jar org.ow2.asm:asm-util, 9.9.1" | ||
| spec.requirements << "jar org.ow2.asm:asm-commons, 9.9.1" | ||
| spec.requirements << "jar org.ow2.asm:asm-analysis, 9.9.1" | ||
| else | ||
| spec.extensions = %w{ext/rbs_extension/extconf.rb} | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation says it is generated, but the comments in that file say "Hand-maintained, NOT auto-generated". Claude is getting confused here.