Skip to content

Update jffi dependency scope to 'provided' - #219

Merged
andreaTP merged 5 commits into
bytecodealliance:mainfrom
headius:patch-1
Oct 2, 2026
Merged

andreaTP merged 5 commits into
bytecodealliance:mainfrom
headius:patch-1

Conversation

@headius

@headius headius commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

JFFI should not be a hard dependency of Redline, because that disallows having the version float in projects that utilize Redline like JRuby. Moving this to "provided" makes the dependency soft, expecting that Redline users will "provide" JFFI at an appropriate level.

This was previously fixed for Redline in roastedroot/chicory-redline#20 but it appears to have gotten lost along the way.

JFFI should not be a hard dependency of Redline, because that disallows having the version float in projects that utilize Redline like JRuby. Moving this to "provided" makes the dependency soft, expecting that Redline users will "provide" JFFI at an appropriate level.

This was previously fixed for Redline in roastedroot/chicory-redline#20 but it appears to have gotten lost along the way.
@headius

headius commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Example error from JRuby's dependency convergence check:

[INFO] Dependency convergence error for com.github.jnr:jffi:1.4.3 paths to dependency are:
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-com.github.jnr:jnr-ffi:2.3.3
[INFO]         +-com.github.jnr:jffi:1.4.3
[INFO] and
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-com.github.jnr:jnr-ffi:2.3.3
[INFO]         +-com.github.jnr:jffi:1.4.3
[INFO] and
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-com.github.jnr:jffi:1.4.3
[INFO] and
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-com.github.jnr:jffi:1.4.3
[INFO] and
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-org.ruby-lang:prism-parser-wasm:0.0.5
[INFO]         +-run.endive:redline-runner-jffi-experimental:1.1.0
[INFO]           +-com.github.jnr:jffi:1.4.0
[INFO] and
[INFO] +-org.jruby:GH-6081-dependency-convergence:1-SNAPSHOT
[INFO]   +-org.jruby:jruby:10.1.3.0-SNAPSHOT
[INFO]     +-org.jruby:jruby-base:10.1.3.0-SNAPSHOT
[INFO]       +-org.ruby-lang:prism-parser-wasm:0.0.5
[INFO]         +-run.endive:redline-runner-jffi-experimental:1.1.0
[INFO]           +-com.github.jnr:jffi:1.4.0

@headius

headius commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Similar to the previous PR, I believe tests that consume the JFFI backend need to include an explicit JFFI dependency.

@andreaTP

Copy link
Copy Markdown
Contributor

I think is fine, sorry, I missed this one, will have a look at the CI and merge soon.
Thanks for the contribution @headius !

With jffi in provided scope, the dependency analyzer flags the native
classifier jar as unused, since it has no classes. Its pattern filter
cannot match a classifier, so exempt com.github.jnr:jffi in
runner-jffi; the main jar is genuinely used there.

Provided is not transitive, so runner-jffi-tests and the redline-e2e
IT now declare jffi and jffi:native themselves; without them the IT
fails with NoClassDefFoundError: com/kenai/jffi/MemoryIO.

Document that jffi users add both artifacts, and that a missing jffi
is an error rather than a silent fallback.
Restore jffi to its normal scopes in redline-runner-jffi, so an
application that adds the runner gets jffi with it, and drop the
analyzer exclusion and the explicit jffi dependencies that the
provided scope required.

The version conflict comes from libraries such as prism-parser-wasm
depending on the runner at compile scope, which forces their jffi
version on applications like JRuby. Document that libraries declare
the runner as provided, so the application picks the runner and jffi.

@andreaTP andreaTP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andreaTP
andreaTP merged commit 4f2f11f into bytecodealliance:main Oct 2, 2026
25 checks passed
@headius
headius deleted the patch-1 branch October 2, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants