< prev index next >

jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java

Print this page

        

@@ -35,29 +35,26 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UncheckedIOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.io.UncheckedIOException;
 import java.io.Writer;
 import java.lang.module.ModuleDescriptor;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
-import java.nio.file.attribute.PosixFileAttributeView;
 import java.nio.file.attribute.PosixFilePermission;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.stream.Collectors;
+
 import jdk.tools.jlink.internal.BasicImageWriter;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.ResourcePool;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;

@@ -169,19 +166,20 @@
             // populate release properties up-front. targetOsName
             // field is assigned from there and used elsewhere.
             Properties release = releaseProperties(files);
             Path bin = root.resolve("bin");
 
-            files.entries().forEach(f -> {
-                if (!f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
+            files.entries()
+                .filter(f -> f.type() != ResourcePoolEntry.Type.CLASS_OR_RESOURCE)
+                .forEach(f -> {
                     try {
                         accept(f);
                     } catch (IOException ioExp) {
                         throw new UncheckedIOException(ioExp);
                     }
-                }
             });
+
             files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.packages().isEmpty()) {
                     modules.add(m.name());
                 }

@@ -345,26 +343,32 @@
     }
 
     private void accept(ResourcePoolEntry file) throws IOException {
         String fullPath = file.path();
         String module = "/" + file.moduleName() + "/";
-        String filename = fullPath.substring(module.length());
+        String path = fullPath.substring(module.length());
         // Remove radical native|config|...
-        filename = filename.substring(filename.indexOf('/') + 1);
+        String filename = path.substring(path.indexOf('/') + 1);
         try (InputStream in = file.content()) {
             switch (file.type()) {
                 case NATIVE_LIB:
                     writeEntry(in, destFile(nativeDir(filename), filename));
                     break;
                 case NATIVE_CMD:
-                    Path path = destFile("bin", filename);
-                    writeEntry(in, path);
-                    path.toFile().setExecutable(true);
+                    Path p = destFile("bin", filename);
+                    writeEntry(in, p);
+                    p.toFile().setExecutable(true);
                     break;
                 case CONFIG:
                     writeEntry(in, destFile("conf", filename));
                     break;
+                case HEADER_FILE:
+                    writeEntry(in, destFile("include", filename));
+                    break;
+                case MAN_PAGE:
+                    writeEntry(in, destFile("man", filename));
+                    break;
                 case TOP:
                     break;
                 case OTHER:
                     if (file instanceof SymImageFile) {
                         SymImageFile sym = (SymImageFile) file;
< prev index next >