-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Java 9 long classpath support to enable deterministic class loading order #3280
Conversation
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.
Looks good! Only minor comments. We may want to update the issues listed above (or add an entry in the FAQ) with the new workaround once this feature is released.
...on/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
Outdated
Show resolved
Hide resolved
...on/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
Outdated
Show resolved
Hide resolved
...rc/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java
Show resolved
Hide resolved
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.
Will merge this today.
...on/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
Outdated
Show resolved
Hide resolved
...on/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java
Outdated
Show resolved
Hide resolved
...rc/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java
Show resolved
Hide resolved
Hmm.... actually I think I found an issue with this. Looking into it. |
Nope, false alarm. It was that I wanted to clean up the code a bit last week. |
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.
Took another look. LGTM
Fixes #1871 (where #2733 and #1907 are duplicates).
Also addresses #2471 (AppCDS), #894, #1640, and #3147.
As discussed in the previous PR (#2866 (comment)) , for Java 9+, we can always achieve explicitly listing all the dependencies by leveraging the argument file support in Java 9+, without the risk that some OS may not be able to handle an exceptionally long command. This mode will be the default for Java 9+ apps.
With this, we can always preserve the exact dependency loading order defined by the build system. Going forward, the
expandClasspathDependencies
option will have no effect with Java 9+. OTOH, Java <=8 will have to continue to setexpandClasspathDependencies
if the user wants toNotable implementation details
The design has changed from the initial one.
It creates a new layer named "jvm arg files".
Two argument files will be created inside the layer:
/app/jib-classpath-file
/app/jib-main-class-file
Note that the main class file is not used by the implementation and thus unnecessary in this sense. (Keep reading.)
The arg files are always created, whether it's Java 8 or 9+, or even when the user sets a custom entrypoint.
The arg files will be very useful for people who want to get the classpath and the main class inferred by Jib at runtime. Being able to do so has been one of the most requested features that will eliminate the ugly workaround where the user had to hard-code the values that may change in newer Jib versions (e.g., by this PR). It'll be easy to read these files in an entrypoint shell script. Some notable examples: