Skip to content

Maven tweaks for usability#4039

Merged
kddnewton merged 2 commits intoruby:mainfrom
headius:maven_tweaks
Apr 1, 2026
Merged

Maven tweaks for usability#4039
kddnewton merged 2 commits intoruby:mainfrom
headius:maven_tweaks

Conversation

@headius
Copy link
Copy Markdown
Contributor

@headius headius commented Mar 24, 2026

Based on review comments from #4031 I've made a few additional tweaks.

  • Template sources are now generated into src/main/java-templates so they are not deleted by mvn clean.
  • The WASM build is generated to src/main/wasm since it is an input to the build (and not a test resource as before).
  • The build-java-truffleruby GHA job now uploads a copy of the generated sources for TruffleRuby, to make it easier to copy.

@headius
Copy link
Copy Markdown
Contributor Author

headius commented Mar 24, 2026

The archive of the sources generated specifically for TruffleRuby could be moved to a separate job if that would be cleaner.

@eregon
Copy link
Copy Markdown
Member

eregon commented Mar 24, 2026

Could Loader.java and Nodes.java simply be in java/api/src/main/java/org/ruby_lang/prism, as siblings of e.g ParseResult.java?
They are not generated by the Maven build and it's expected to run rake so it should be fine, no?

@kddnewton kddnewton added the java Pull requests that update Java code label Mar 25, 2026
headius added 2 commits March 31, 2026 15:18
This path avoids the sources getting wiped out during `mvn clean`,
since they are not generated during the maven build.

This patch also moves the generated WASM build under src/main/wasm
since it is really a source file and not a test file. It will not
be included in the built artifact.
The JNI bindings are only used by TruffleRuby, so there's no real
value in publishing them to Maven. This avoids us being blocked on
figuring out a reliable way to build and publish native artifacts
to Maven, something that has never really had a good answer.

Instead, we will push the "api" and "wasm" modules for now for
JRuby's internal parser use, and prepare to push a second "wasm"
module to be used by the gem (with full non-semantic data). The
remaining artifacts will be the FFI-based gem (opt-in for JRuby
users and built at install time) and the raw native library (bound
by JRuby using JNR or Panama and to be built and installed by a
JRuby-specific gem a la jruby-prism-parser.
@headius headius marked this pull request as ready for review March 31, 2026 20:21
@headius
Copy link
Copy Markdown
Contributor Author

headius commented Mar 31, 2026

After removing the native module altogether along with the archive of sources for TruffleRuby, this boiled down to just some template-generation tweaks.

The updated plan for published artifacts (from a JRuby perspective):

  • prism-parser-api: the Java API
  • prism-parser-wasm: the WASM backend of the internal Prism parser build (no non-semantic contents, used by JRuby)
  • prism-parser-wasm-full: (name pending) the WASM build of Prism with full non-semantic info, to be used from FFI by JRuby for now and for a full non-semantic enhancement to the API in the future.

Of these, the first two are working as published Maven modules today and JRuby 10.1 will ship with support for them. Additional Ruby artifacts built around these:

  • prism gem for JRuby: defaulting to using the WASM backend (prism-parser-wasm-full)
  • prism-native gem for JRuby: essentially what the FFI version of the gem contains today, opt-in for JRuby users who require native performance out of the gem.
  • jruby-prism-parser gem: (name pending) a gem whos sole purpose is to build the native non-semantic prism parser and install into the current JRuby distribution for our internal parsing, for users who want native prism performance at boot with JRuby.

Of these, only the jruby-prism-parser gem exists but it has never been merged into the main prism repository. The WASM-based gem is WIP in #4017. The native gem for JRuby will be a rework of the existing FFI gem.

@kddnewton This is ready to be merged.

@kddnewton kddnewton merged commit 8be5667 into ruby:main Apr 1, 2026
68 checks passed
@headius headius deleted the maven_tweaks branch April 1, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants