RFR: 8156499 Update jlink to support creating images with modules that are packaged as multi-release JARs
mandy.chung at oracle.com
Sun Aug 21 02:49:11 UTC 2016
> On Aug 12, 2016, at 5:33 PM, Steve Drach <steve.drach at oracle.com> wrote:
> I didn’t have it right ;-) It turns out a JarFile stream of versioned entries was more interesting than I initially thought. Here’s another webrev. It’s not clear to me if I should include the change to JarFile in this changeset or if it should be in a stand alone changeset. Advice appreciated.
> webrev: http://cr.openjdk.java.net/~sdrach/8156499/webrev.02/ <http://cr.openjdk.java.net/~sdrach/8156499/webrev.02/>
I think it’s time to enumerate several test cases of a multi-release Jar content, e.g. a MRJAR with a new concealed package in versioned entries but not in the base entry (I believe that’s allowed?? version 9 & 10 entries that makes sure versioned 10 entries are skipped. It should also check the module-info.class with different requires and ensure that the image jlink created contains the module-info.class of the right version. This would help the review of this change.
I think ModularJarArchive is the right place to add the versioned entries support. JarArchive should probably be renamed to ZipArchive (that’s an existing code).
Version of JarFile
221 jarFile = new JarFile(file.toFile(), true, ZipFile.OPEN_READ, JarFile.runtimeVersion());
JarFile::runtimeVersion is the version of the jlink tool. You should not use the version of the jlink runtime. Instead, this should use the version of java.base which will be the runtime version of the image being created.
ImageHelper::newArchive is one place where it creates JarArchive. You can find java.base module from the Configuration passed to ImageHelper constructor via Configuration.findModule(“java.base”) and from its module descriptor. Jlink implementation is rather over engineering at the moment. You will have to find if there are other places to pass the right versoin when creating ModularJarArchive.
179 // a legal multi-release jar always has a base entry
I thought that a new class or a new concealed package can be added in a versioned entry in MRJAR. If so, those cases will not be included in the finalNames.
Have you considered adding a new method in JarFile to return the versioned entry name and/or the version? If it’s the base version, it will return the same value as JarFile::getName. As we discussed the jdeps support for MRJAR offline, a tool would be interested in getting the base entry name, versioned entry name, or even version.
More information about the jigsaw-dev