< prev index next >

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java

Print this page

        

*** 38,47 **** --- 38,48 ---- import java.nio.ByteOrder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; + import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.tools.jlink.internal.TaskHelper.BadArgs; import static jdk.tools.jlink.internal.TaskHelper.JLINK_BUNDLE;
*** 52,61 **** --- 53,63 ---- import jdk.tools.jlink.internal.ImagePluginStack.ImageProvider; import jdk.tools.jlink.plugin.PluginException; import jdk.tools.jlink.builder.DefaultImageBuilder; import jdk.tools.jlink.plugin.Plugin; import jdk.internal.misc.SharedSecrets; + import jdk.internal.module.WarnIfResolvedReason; /** * Implementation for the jlink tool. * * ## Should use jdk.joptsimple some day.
*** 258,268 **** ImageProvider imageProvider = createImageProvider(finder, config.getModules(), config.getByteOrder(), null, ! IGNORE_SIGNING_DEFAULT); // Then create the Plugin Stack ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(plugins); //Ask the stack to proceed; --- 260,271 ---- ImageProvider imageProvider = createImageProvider(finder, config.getModules(), config.getByteOrder(), null, ! IGNORE_SIGNING_DEFAULT, ! null); // Then create the Plugin Stack ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(plugins); //Ask the stack to proceed;
*** 326,336 **** // First create the image provider ImageProvider imageProvider = createImageProvider(finder, roots, options.endian, options.packagedModulesPath, ! options.ignoreSigning); // Then create the Plugin Stack ImagePluginStack stack = ImagePluginConfiguration. parseConfiguration(taskHelper.getPluginsConfig(options.output)); --- 329,340 ---- // First create the image provider ImageProvider imageProvider = createImageProvider(finder, roots, options.endian, options.packagedModulesPath, ! options.ignoreSigning, ! log); // Then create the Plugin Stack ImagePluginStack stack = ImagePluginConfiguration. parseConfiguration(taskHelper.getPluginsConfig(options.output));
*** 380,394 **** throw new InternalError(m + " does not have a location"); URI uri = ouri.get(); return Paths.get(uri); } private static ImageProvider createImageProvider(ModuleFinder finder, Set<String> roots, ByteOrder order, Path retainModulesPath, ! boolean ignoreSigning) throws IOException { if (roots.isEmpty()) { throw new IllegalArgumentException("empty modules and limitmods"); } --- 384,403 ---- throw new InternalError(m + " does not have a location"); URI uri = ouri.get(); return Paths.get(uri); } + private static final Predicate<ModuleDescriptor> hasIncubatorWarning = md -> + SharedSecrets.getJavaLangModuleAccess().warnIfResolvedReason(md) + == WarnIfResolvedReason.INCUBATING; + private static ImageProvider createImageProvider(ModuleFinder finder, Set<String> roots, ByteOrder order, Path retainModulesPath, ! boolean ignoreSigning, ! PrintWriter log) throws IOException { if (roots.isEmpty()) { throw new IllegalArgumentException("empty modules and limitmods"); }
*** 396,405 **** --- 405,428 ---- Configuration cf = Configuration.empty() .resolveRequires(finder, ModuleFinder.of(), roots); + // issue a warning for any incubating modules in the configuration + if (log != null) { + String incubatingModules = cf.modules() + .stream() + .map(ResolvedModule::reference) + .map(ModuleReference::descriptor) + .filter(hasIncubatorWarning) + .map(ModuleDescriptor::name) + .collect(Collectors.joining(", ")); + + if (!"".equals(incubatingModules)) + log.println("WARNING: using incubating module(s): " + incubatingModules); + } + Map<String, Path> mods = cf.modules().stream() .collect(Collectors.toMap(ResolvedModule::name, JlinkTask::toPathLocation)); return new ImageHelper(cf, mods, order, retainModulesPath, ignoreSigning); }
< prev index next >