< prev index next >
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java
Print this page
*** 38,47 ****
--- 38,48 ----
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
import jdk.tools.jlink.internal.Archive.Entry;
import jdk.tools.jlink.internal.Archive.Entry.EntryType;
import jdk.tools.jlink.internal.ResourcePoolManager.CompressedModuleData;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ResourcePool;
*** 120,133 ****
all.addAll(es.get(true));
entriesForModule.put(mn, all);
});
}
- public static boolean isClassPackage(String path) {
- return path.endsWith(".class") && !path.endsWith("module-info.class");
- }
-
public static void recreateJimage(Path jimageFile,
Set<Archive> archives,
ImagePluginStack pluginSupport)
throws IOException {
try {
--- 121,130 ----
*** 266,291 ****
}
});
for (Archive archive : archives) {
String mn = archive.moduleName();
for (Entry entry : entriesForModule.get(mn)) {
! String path;
! if (entry.type() == EntryType.CLASS_OR_RESOURCE) {
! // Removal of "classes/" radical.
! path = entry.name();
! if (path.endsWith("module-info.class")) {
! path = "/" + path;
! } else {
! path = "/" + mn + "/" + path;
! }
! } else {
! // Entry.path() contains the kind of file native, conf, bin, ...
! // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
! path = "/" + mn + "/" + entry.path();
! }
!
! resources.add(new ArchiveEntryResourcePoolEntry(mn, path, entry));
}
}
return resources;
}
--- 263,273 ----
}
});
for (Archive archive : archives) {
String mn = archive.moduleName();
for (Entry entry : entriesForModule.get(mn)) {
! resources.add(new ArchiveEntryResourcePoolEntry(mn, entry.getResourceName(), entry));
}
}
return resources;
}
*** 318,327 ****
--- 300,323 ----
String[] array = new String[result.size()];
return result.toArray(array);
}
+ /**
+ * Returns the path of the resource.
+ */
+ public static String resourceName(String path) {
+ Objects.requireNonNull(path);
+ String s = path.substring(1);
+ int index = s.indexOf("/");
+ return s.substring(index + 1);
+ }
+
+ public static String toPackage(String name) {
+ return toPackage(name, false);
+ }
+
private static String toPackage(String name, boolean log) {
int index = name.lastIndexOf('/');
if (index > 0) {
return name.substring(0, index).replace('/', '.');
} else {
< prev index next >