Open dougxc opened 2 years ago
This is an unusual plugin and not intuitive to specify "--copy-files" without a value. So if it does move forward as is then we should seek out a better name.
At a high-level, the jlink tool produces a run-time image from a set modules. The desire here seems to be to overlay, or copy, files that aren't part of any module into the run-time image. If this replaces files that are in a module then it suggests the need for a jlink --patch-module option, something that hasn't been needed to date. Another part seems to be the desire to persist the list of files that are copied so that it can be used again when the resulting run-time image is used to stamp out another run-time image. So I think the main question is whether adding this feature make sense or not. If it doesn't make sense then how hard would be for these other files to be packaged into a module so that they can participate in the normal jlink process? Is it mostly that libjvmcicompiler.so is huge and retaining the packaged modules double the space?
As regards the details then ${java.home}/conf/jlink.copyfiles feels like an attractive nuisance. Maybe this could be resource that is generated at link time into a resource (like jdk/internal/vm/options) so it can't be edited. Could the initial copy be explicit so that it is clear from the initial jlink command what is going on? By this I mean, could the list of files to copy be specified to the option with something like this:
--copy-files lib/libjvmcicompiler.so=/graal/libs/libjvmcicompiler.so,lib/truffle.jar=/graal/libs/truffle.jar
This is an unusual plugin and not intuitive to specify "--copy-files" without a value. So if it does move forward as is then we should seek out a better name.
How about --enable-copy-files
? It would be disabled with --disable-plugin
option.
Maybe this could be resource that is generated at link time into a resource
For completeness, this is the workflow we want when building GraalVM:
libjvmcicompiler.so
.libjvmcicompiler.so
. We do not want to have to use jlink for this step as it's very slow. Furthermore, we don't to pay the footprint of libjvmcicompiler.so
twice, once in lib/libjvmcicompiler.so
and again packaged in a jmod file. This approach is incompatible with the suggested--copy-files
command line option since libjvmcicompiler.so
does not yet exist when creating the base image.libjvmcicompiler.so
without any extra jlink options.
Javadoc for
CopyFilesPlugin
:For GraalVM, this means on linux, we'd generate
conf/jlink.copyfiles
to contain:It could also be used to copy across everything in the
language/
directory if we wanted.