Skip to content

jruby base artifact#6233

Merged
headius merged 21 commits intomasterfrom
jruby-base
Sep 15, 2020
Merged

jruby base artifact#6233
headius merged 21 commits intomasterfrom
jruby-base

Conversation

@mkristian
Copy link
Member

@headius please have a look. I check both lib/jruby.jar and jruby-complete.jar and it needs more verifications. but it is a first idea how this could look like.

@mkristian mkristian requested review from enebo and headius May 19, 2020 16:01
@mkristian mkristian self-assigned this May 19, 2020
@mkristian
Copy link
Member Author

tests are for sure more work

@headius
Copy link
Member

headius commented Jun 2, 2020

@mkristian This looks right at a glance. We need to get @enebo on board and obviously get tests passing, but this is largely what I had envisioned for jruby-base.

@mkristian
Copy link
Member Author

the last commit is just the idea to keep changes minimal, i.e. it keeps source in old place but /core/pom.rb is build jruby-base artifact and the /shaded/pom.rb is building jruby-core.

this is not ideal but the moment I had this original commit in place I realized that it breaks open PR and it is hard to keep in sync with master. (might be wrong here as well - just an initial observation)

@mkristian
Copy link
Member Author

@headius the failure one the dependency-check (JRuby CI) can be probably fixed by add -Prelease to the maven command. a good idea any ways as it builds all maven artifacts

@kares
Copy link
Member

kares commented Aug 7, 2020

interesting, so there would be a non-shaded (jruby-base), is this still being considered (e.g. for 9.3) ?

@headius
Copy link
Member

headius commented Aug 12, 2020

@kares Yes, that is the goal. We would then have jruby-base that's just the JRuby-sources, jruby-core which is jruby-base + shaded dependencies, and jruby-complete which is jruby-core plus the standard library. Basically, it would allow packagers to include JRuby and dependencies in their own ways, as in #6205.

This needs to be evaluated and merged ASAP if we intend to get it into 9.3.

Copy link
Member

@headius headius left a comment

Choose a reason for hiding this comment

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

This seems pretty mundane and fulfills what we want. I say we merge to master and proceed from there.

@headius
Copy link
Member

headius commented Aug 12, 2020

There seems to be one remaining issue with the jruby-jars artifact... it errors out with an error that looks like it can't find the shaded location of ASM.

I've pushed a change to fix part of the check_versions.sh script, but the jruby-jars artifact is still not building properly.

@mkristian I'm not sure what's broken here... can you help so we can merge this?

@headius
Copy link
Member

headius commented Aug 12, 2020

Ah there also seems to be a problem with the dependency convergence testing... so that needs to be resolved as well.

@mkristian
Copy link
Member Author

@headius the dependencies convergance can be probably fixed by adding --Preleases as this does build all the artifact any ways and you want to test all artifacts here.

@headius
Copy link
Member

headius commented Aug 21, 2020

@mkristian Assuming I did what you suggested, it did not appear to help.

The dependency-convergence build still fails with this message during the jruby-core build:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar (default-jar) on project jruby-core: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. -> [Help 1]

The jruby-jars artifact also still fails to build for some reason.

@mkristian
Copy link
Member Author

OK - fixed dependency-check but seems like I broke all others.

@headius
Copy link
Member

headius commented Sep 15, 2020

Looking good now!

@headius
Copy link
Member

headius commented Sep 15, 2020

I'm going to look into the size checks and see why jruby-core is so off, but otherwise this is darn close to being done.

@enebo Any concerns?

@headius
Copy link
Member

headius commented Sep 15, 2020

Ok, this is confusing.

We shade all dependencies into the "dist" jar that goes in lib, on both master and base branches.

It seems the shading for the "core" jar has changed however.

From master, I see the following output when creating the jruby-core jar for the check-versions.sh script:

[INFO] --- maven-jar-plugin:3.0.0:jar (default-jar) @ jruby-core ---
[INFO] Building jar: /Users/headius/projects/jruby/core/target/jruby-core-9.3.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-shade-plugin:3.1.0:shade (create lib/jruby.jar) @ jruby-core ---
[INFO] Including org.ow2.asm:asm:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-commons:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-tree:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-analysis:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-util:jar:7.1 in the shaded jar.
[INFO] Including com.github.jnr:jnr-netdb:jar:1.2.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-enxio:jar:0.32.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-unixsocket:jar:0.38.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-posix:jar:3.1.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-constants:jar:0.10.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-ffi:jar:2.2.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-a64asm:jar:1.0.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-x86asm:jar:1.0.2 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:1.3.0 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:native:1.3.0 in the shaded jar.
[INFO] Including org.jruby.joni:joni:jar:2.1.40 in the shaded jar.
[INFO] Including org.jruby.jcodings:jcodings:jar:1.0.55 in the shaded jar.
[INFO] Including org.jruby:dirgra:jar:0.3 in the shaded jar.
[INFO] Including com.headius:invokebinder:jar:1.11 in the shaded jar.
[INFO] Including com.headius:options:jar:1.4 in the shaded jar.
[INFO] Including com.jcraft:jzlib:jar:1.1.3 in the shaded jar.
[INFO] Including com.martiansoftware:nailgun-server:jar:0.9.1 in the shaded jar.
[INFO] Including joda-time:joda-time:jar:2.10.5 in the shaded jar.
[INFO] Including me.qmx.jitescript:jitescript:jar:0.4.1 in the shaded jar.
[INFO] Including com.headius:backport9:jar:1.8 in the shaded jar.
[INFO] Excluding javax.annotation:javax.annotation-api:jar:1.3.1 from the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] 
[INFO] --- maven-shade-plugin:3.1.0:shade (shade dependencies into jar) @ jruby-core ---
[INFO] Including org.ow2.asm:asm:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-commons:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-tree:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-analysis:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-util:jar:7.1 in the shaded jar.
[INFO] Excluding com.github.jnr:jnr-netdb:jar:1.2.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jnr-enxio:jar:0.32.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jnr-unixsocket:jar:0.38.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jnr-posix:jar:3.1.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jnr-constants:jar:0.10.0 from the shaded jar.
[INFO] Including com.github.jnr:jnr-ffi:jar:2.2.0 in the shaded jar.
[INFO] Excluding com.github.jnr:jnr-a64asm:jar:1.0.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jnr-x86asm:jar:1.0.2 from the shaded jar.
[INFO] Excluding com.github.jnr:jffi:jar:1.3.0 from the shaded jar.
[INFO] Excluding com.github.jnr:jffi:jar:native:1.3.0 from the shaded jar.
[INFO] Excluding org.jruby.joni:joni:jar:2.1.40 from the shaded jar.
[INFO] Excluding org.jruby.jcodings:jcodings:jar:1.0.55 from the shaded jar.
[INFO] Excluding org.jruby:dirgra:jar:0.3 from the shaded jar.
[INFO] Excluding com.headius:invokebinder:jar:1.11 from the shaded jar.
[INFO] Excluding com.headius:options:jar:1.4 from the shaded jar.
[INFO] Excluding com.jcraft:jzlib:jar:1.1.3 from the shaded jar.
[INFO] Excluding com.martiansoftware:nailgun-server:jar:0.9.1 from the shaded jar.
[INFO] Excluding joda-time:joda-time:jar:2.10.5 from the shaded jar.
[INFO] Including me.qmx.jitescript:jitescript:jar:0.4.1 in the shaded jar.
[INFO] Excluding com.headius:backport9:jar:1.8 from the shaded jar.
[INFO] Excluding javax.annotation:javax.annotation-api:jar:1.3.1 from the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /Users/headius/projects/jruby/core/target/jruby-core-9.3.0.0-SNAPSHOT.jar with /Users/headius/projects/jruby/core/target/jruby-core-9.3.0.0-SNAPSHOT-shaded.jar

This produces a jar that is indeed only about 10MB, as the script expects. It appears from this that the only shaded library is ASM, which confuses me because I thought we were also shading everything that depends on ASM like jitescript and jnr-ffi. The jnr-ffi shading in particular would be the cause of #6205.

However, the output from the base branch now shows jruby-core including everything:

[INFO] --- maven-jar-plugin:3.0.0:jar (default-jar) @ jruby-core ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/headius/projects/jruby/shaded/target/jruby-core-9.3.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-shade-plugin:3.1.0:shade (create lib/jruby.jar) @ jruby-core ---
[INFO] Including org.jruby:jruby-base:jar:9.3.0.0-SNAPSHOT in the shaded jar.
[INFO] Including org.ow2.asm:asm:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-commons:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-tree:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-analysis:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-util:jar:7.1 in the shaded jar.
[INFO] Including com.github.jnr:jnr-netdb:jar:1.1.6 in the shaded jar.
[INFO] Including com.github.jnr:jnr-enxio:jar:0.28 in the shaded jar.
[INFO] Including com.github.jnr:jnr-unixsocket:jar:0.33 in the shaded jar.
[INFO] Including com.github.jnr:jnr-posix:jar:3.0.58 in the shaded jar.
[INFO] Including com.github.jnr:jnr-constants:jar:0.9.15 in the shaded jar.
[INFO] Including com.github.jnr:jnr-ffi:jar:2.1.15 in the shaded jar.
[INFO] Including com.github.jnr:jnr-a64asm:jar:1.0.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-x86asm:jar:1.0.2 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:1.2.23 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:native:1.2.23 in the shaded jar.
[INFO] Including org.jruby.joni:joni:jar:2.1.40 in the shaded jar.
[INFO] Including org.jruby.jcodings:jcodings:jar:1.0.55 in the shaded jar.
[INFO] Including org.jruby:dirgra:jar:0.3 in the shaded jar.
[INFO] Including com.headius:invokebinder:jar:1.11 in the shaded jar.
[INFO] Including com.headius:options:jar:1.4 in the shaded jar.
[INFO] Including com.jcraft:jzlib:jar:1.1.3 in the shaded jar.
[INFO] Including com.martiansoftware:nailgun-server:jar:0.9.1 in the shaded jar.
[INFO] Including joda-time:joda-time:jar:2.10.5 in the shaded jar.
[INFO] Including me.qmx.jitescript:jitescript:jar:0.4.1 in the shaded jar.
[INFO] Including com.headius:backport9:jar:1.8 in the shaded jar.
[INFO] Excluding javax.annotation:javax.annotation-api:jar:1.3.1 from the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[INFO] 
[INFO] --- maven-shade-plugin:3.1.0:shade (shade dependencies into jar) @ jruby-core ---
[INFO] Including org.jruby:jruby-base:jar:9.3.0.0-SNAPSHOT in the shaded jar.
[INFO] Including org.ow2.asm:asm:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-commons:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-tree:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-analysis:jar:7.1 in the shaded jar.
[INFO] Including org.ow2.asm:asm-util:jar:7.1 in the shaded jar.
[INFO] Including com.github.jnr:jnr-netdb:jar:1.1.6 in the shaded jar.
[INFO] Including com.github.jnr:jnr-enxio:jar:0.28 in the shaded jar.
[INFO] Including com.github.jnr:jnr-unixsocket:jar:0.33 in the shaded jar.
[INFO] Including com.github.jnr:jnr-posix:jar:3.0.58 in the shaded jar.
[INFO] Including com.github.jnr:jnr-constants:jar:0.9.15 in the shaded jar.
[INFO] Including com.github.jnr:jnr-ffi:jar:2.1.15 in the shaded jar.
[INFO] Including com.github.jnr:jnr-a64asm:jar:1.0.0 in the shaded jar.
[INFO] Including com.github.jnr:jnr-x86asm:jar:1.0.2 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:1.2.23 in the shaded jar.
[INFO] Including com.github.jnr:jffi:jar:native:1.2.23 in the shaded jar.
[INFO] Including org.jruby.joni:joni:jar:2.1.40 in the shaded jar.
[INFO] Including org.jruby.jcodings:jcodings:jar:1.0.55 in the shaded jar.
[INFO] Including org.jruby:dirgra:jar:0.3 in the shaded jar.
[INFO] Including com.headius:invokebinder:jar:1.11 in the shaded jar.
[INFO] Including com.headius:options:jar:1.4 in the shaded jar.
[INFO] Including com.jcraft:jzlib:jar:1.1.3 in the shaded jar.
[INFO] Including com.martiansoftware:nailgun-server:jar:0.9.1 in the shaded jar.
[INFO] Including joda-time:joda-time:jar:2.10.5 in the shaded jar.
[INFO] Including me.qmx.jitescript:jitescript:jar:0.4.1 in the shaded jar.
[INFO] Including com.headius:backport9:jar:1.8 in the shaded jar.
[INFO] Excluding javax.annotation:javax.annotation-api:jar:1.3.1 from the shaded jar.

Perhaps we had some miscommunication or confusion on my part, but the published jruby-core jar should be structured exactly like it was in JRuby 9.2, with the same dependencies shaded. I may have been under the impression that jruby-core shaded more than it did.

If the core jar is trimmed back to the same shaded dependencies, I think this will be ready. I'll try to do that.

I think we were confused by lib/jruby.jar when discussing the
jruby-core module and the libraries it shades.
The lib/jruby.jar file for the JRuby distribution shades in all
Java depdendencies, while the actual published jruby-core jar only
shades ASM (hidden), jitescript and jnr-ffi (because they depend
on ASM).

On the new "base" branch, we originally planned for "base" to be
the fully-unshaded jar and "core" to be "base plus shaded Java
dependencies", but this does not match the historical "core" jar
we have been publishing.

This commit restores the limited shading for the jruby-core jar.

The jruby-core module may now be the least useful; it does not
shade in all dependencies it needs, but at the same time it shades
enough (jnr-ffi) to cause version conflicts with other libraries.
I believe we should consider jruby-core deprecated for 9.3 in
favor of jruby-base as the baseline artifact, with core continuing
to be base + relocated ASM and complete being base + all Java deps
and the Ruby stdlib.
@headius
Copy link
Member

headius commented Sep 15, 2020

I've pushed a commit that restores jruby-core to shading only what it did before.

We may want to deprecate that artifact going forward in 9.3. It doesn't shade everything it needs (so you need to deal with that yourself) but at the same time it shades enough to cause conflicts like in #6205 because it pulls in and does not relocate jnr-ffi. The future is jruby-base with no shading or jruby-complete with everything shaded, methinks.

The core build does not appear to trigger when building jruby-jars
now after the move to the "base" jar setup. I add jruby-core as
a compile dependency here to ensure it builds, and then explicitly
add only the "core complete" jar that we copy from the JRuby dist
lib dir.
@headius
Copy link
Member

headius commented Sep 15, 2020

jruby-jars appears to not be triggering a build of the "lib" version of the core jar. I have a patch locally that I will push, hopefully it's doing the right thing @mkristian?

@headius headius merged commit 57e3167 into master Sep 15, 2020
@headius
Copy link
Member

headius commented Sep 15, 2020

@mkristian Everything is green now and I believe the artifacts are being assembled correct. We can do additional tweaks, but this is now landed on master. Thank you for your help as always!

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.

3 participants