< prev index next >

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

Print this page

        

@@ -164,11 +164,11 @@
         String  saveoptsfile;
         boolean version;
         boolean fullVersion;
         final List<Path> modulePath = new ArrayList<>();
         final Set<String> limitMods = new HashSet<>();
-        final Set<String> addMods = new HashSet<>();
+        final Set<String> addMods = new LinkedHashSet<>();
         Path output;
         Path packagedModulesPath;
         ByteOrder endian = ByteOrder.nativeOrder();
         boolean ignoreSigning = false;
     }

@@ -398,11 +398,11 @@
                                  ModuleFinder.of(),
                                  roots);
 
         Map<String, Path> mods = cf.modules().stream()
             .collect(Collectors.toMap(ResolvedModule::name, JlinkTask::toPathLocation));
-        return new ImageHelper(cf, mods, order, retainModulesPath, ignoreSigning);
+        return new ImageHelper(cf, roots, mods, order, retainModulesPath, ignoreSigning);
     }
 
     /*
      * Returns a ModuleFinder that limits observability to the given root
      * modules, their transitive dependences, plus a set of other modules.

@@ -485,20 +485,23 @@
         sb.append(plugins);
         return sb.toString();
     }
 
     private static class ImageHelper implements ImageProvider {
+        final Set<String> rootModules;
         final ByteOrder order;
         final Path packagedModulesPath;
         final boolean ignoreSigning;
         final Set<Archive> archives;
 
         ImageHelper(Configuration cf,
+                    Set<String> rootMods,
                     Map<String, Path> modsPaths,
                     ByteOrder order,
                     Path packagedModulesPath,
                     boolean ignoreSigning) throws IOException {
+            this.rootModules = rootMods;
             this.order = order;
             this.packagedModulesPath = packagedModulesPath;
             this.ignoreSigning = ignoreSigning;
             this.archives = modsPaths.entrySet().stream()
                                 .map(e -> newArchive(e.getKey(), e.getValue()))

@@ -540,11 +543,11 @@
             }
         }
 
         @Override
         public ExecutableImage retrieve(ImagePluginStack stack) throws IOException {
-            ExecutableImage image = ImageFileCreator.create(archives, order, stack);
+            ExecutableImage image = ImageFileCreator.create(archives, rootModules, order, stack);
             if (packagedModulesPath != null) {
                 // copy the packaged modules to the given path
                 Files.createDirectories(packagedModulesPath);
                 for (Archive a : archives) {
                     Path file = a.getPath();
< prev index next >