< prev index next >
src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
Print this page
*** 56,66 ****
import java.util.Properties;
import java.util.Set;
import static 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;
import jdk.tools.jlink.plugin.ResourcePoolEntry.Type;
import jdk.tools.jlink.plugin.ResourcePoolModule;
--- 56,65 ----
*** 147,170 ****
this.root = root;
this.mdir = root.resolve("lib");
Files.createDirectories(mdir);
}
- private void storeRelease(ResourcePool pool) throws IOException {
- Properties props = new Properties();
- Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
- if (release.isPresent()) {
- try (InputStream is = release.get().content()) {
- props.load(is);
- }
- }
- File r = new File(root.toFile(), "release");
- try (FileOutputStream fo = new FileOutputStream(r)) {
- props.store(fo, null);
- }
- }
-
@Override
public void storeFiles(ResourcePool files) {
try {
// populate targetOsName field up-front because it's used elsewhere.
Optional<ResourcePoolModule> javaBase = files.moduleView().findModule("java.base");
--- 146,155 ----
*** 178,190 ****
if (this.targetOsName == null) {
throw new PluginException("TargetPlatform attribute is missing for java.base module");
}
- // store 'release' file
- storeRelease(files);
-
Path bin = root.resolve(BIN_DIRNAME);
// check any duplicated resource files
Map<Path, Set<String>> duplicates = new HashMap<>();
files.entries()
--- 163,172 ----
*** 371,387 ****
return Paths.get(MAN_DIRNAME, entryToFileName(entry));
case LEGAL_NOTICE:
return Paths.get(LEGAL_DIRNAME, entryToFileName(entry));
case TOP:
return Paths.get(entryToFileName(entry));
- case OTHER:
- return Paths.get("other", entryToFileName(entry));
default:
throw new IllegalArgumentException("invalid type: " + entry);
}
}
private void accept(ResourcePoolEntry file) throws IOException {
if (file.linkedTarget() != null && file.type() != Type.LEGAL_NOTICE) {
throw new UnsupportedOperationException("symbolic link not implemented: " + file);
}
--- 353,378 ----
return Paths.get(MAN_DIRNAME, entryToFileName(entry));
case LEGAL_NOTICE:
return Paths.get(LEGAL_DIRNAME, entryToFileName(entry));
case TOP:
return Paths.get(entryToFileName(entry));
default:
throw new IllegalArgumentException("invalid type: " + entry);
}
}
+ private void storeRelease(ResourcePoolEntry release) throws IOException {
+ Properties props = new Properties();
+ try (InputStream is = release.content()) {
+ props.load(is);
+ }
+ File r = new File(root.toFile(), "release");
+ try (FileOutputStream fo = new FileOutputStream(r)) {
+ props.store(fo, null);
+ }
+ }
+
private void accept(ResourcePoolEntry file) throws IOException {
if (file.linkedTarget() != null && file.type() != Type.LEGAL_NOTICE) {
throw new UnsupportedOperationException("symbolic link not implemented: " + file);
}
*** 410,432 ****
Path relPath = source.getParent().relativize(target);
writeSymLinkEntry(root.resolve(source), relPath);
}
break;
case TOP:
! break;
! case OTHER:
! String filename = entryToFileName(file);
! if (file instanceof SymImageFile) {
! SymImageFile sym = (SymImageFile) file;
! Path target = root.resolve(sym.getTargetPath());
! if (!Files.exists(target)) {
! throw new IOException("Sym link target " + target
! + " doesn't exist");
! }
! writeSymEntry(root.resolve(filename), target);
! } else {
! writeEntry(in, root.resolve(filename));
}
break;
default:
throw new InternalError("unexpected entry: " + file.path());
}
--- 401,413 ----
Path relPath = source.getParent().relativize(target);
writeSymLinkEntry(root.resolve(source), relPath);
}
break;
case TOP:
! // only TOP file as of now is "release" file.
! if ("/java.base/release".equals(file.path())) {
! storeRelease(file);
}
break;
default:
throw new InternalError("unexpected entry: " + file.path());
}
< prev index next >