-
-
Notifications
You must be signed in to change notification settings - Fork 925
Modularize all the things #6598
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
Conversation
I have started to try to modularize JRuby itself by adding a proper module-info.java. The related commit spells out the changes, but there is one issue I have been unable to remedy... There is a new compile-time error about the classes https://gist.github.com/headius/14a50f446ab9d0f6976a231c8ec0f915 I will be unable to progress until this issue can be fixed. I have not been able to reproduce in a sample project and nobody so far has been able to explain why this breaks. |
The issue that stopped me from proceeding has been reported as an OpenJDK bug. We will need to find a workaround until the patched versions have become commonplace. |
This is very close. There are a few items that mean we have to punt the remaining work until 9.4.
Of these, the first is the biggest issue. I have commented on the JDK issue asking for a workaround but have not year heard back. |
Updated the PR for latest master and made some additional tweaks, but we're not quite there yet. Tweaks:
Manual changes needed to run JRuby after build:
Once this is all set up, JRuby will at least start to bootstrap itself, but due (I think) to the way we load classloader resources, the JRuby kernel can't boot completely:
Skipping the kernel load gets closer, but the main script gets compiled into a class in the default package, which is not liked by JPMS:
If we also disable JIT compilation, so that the target script does not compile, then the code runs but there's some undiagnosed issue with acquiring Java IO internals, even though we are passing the correct flags at the command line:
So we are getting there but have a number of additional items to work on. I've also noticed that incremental rebuilds seem to fail to find our Here's the
|
Given the remaining issues and the challenge of fixing them while still supporting traditional non-modularized Java, I'm punting this to the next major release. That version will commit to a minimum Java of at least 11 and possibly 17, making the module changes both necessary and easier to deal with. |
* Use newer backport9 to access Java 8 StackWalker * Add module-info for modules we require * Copy jruby-base jar and deps into lib/modules * Modify jruby.bash to handle unshaded jruby and deps as classpath or module path entries * Restructure build for module-info.java There's a remaining issue here to build: CallSite and Main have sibling packages with the same name as lowercase, and that appears to be rejected by the build currently.
Ant is no longer maintained, and as a result there's no module- based version of its jar. We must move this out to a separate library that can be used at build time, such as during JRuby's own uses of the Rake ant targets.
We only have this dependency due to the @generated annotation we add to some generated sources, but neither we nor anyone else ever consumes that annotation.
Default scope for copy-dependencies is "test", which copies all runtime, provided, and test dependencies. We only want runtime in lib/modules.
This patch makes it possible to boot JRuby fully modularized. A few notes: * The org.jruby.base module is now open, because I was too lazy to individually open all of the Ruby kernel paths and there is no way to open them recursively from module-info. * Ruby "kernel" sources have been moved into org.jruby.kernel to aid in accessing them in a module-friendly way. This does, unfortunately, result in paths like org/jruby/kernel/kernel/kernel.rb. An alternative name may be in order.
Using lookup() appears to return a Lookup object that is stricter about access restrictions from a parent module to a child classloader with no module. In this case, the variables in the reified object classes are to be wired up in accessors. Using the lookup() version results in an error: java.lang.IllegalAccessException: symbolic reference class is not accessible: class org.jruby.gen.RubyObject5, from class org.jruby.specialized.RubyObjectSpecializer (module org.jruby.base)
Without this you cannot incrementally build. For some reason clean build still works.
* Drop another Ant reference in favor of Java 11 Files.readString. * Remove unnecessary and absent java.xml.ws.annotation module.
This PR will include changes necessary to fully JPMS modularize JRuby.