< prev index next >
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -57,14 +57,14 @@
import java.util.Set;
import static java.util.stream.Collectors.*;
import jdk.tools.jlink.internal.BasicImageWriter;
import jdk.tools.jlink.internal.ExecutableImage;
+import jdk.tools.jlink.internal.Platform;
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;
import jdk.tools.jlink.plugin.PluginException;
/**
*
* Default Image Builder. This builder creates the default runtime image layout.
@@ -131,11 +131,11 @@
private final Path root;
private final Map<String, String> launchers;
private final Path mdir;
private final Set<String> modules = new HashSet<>();
- private String targetOsName;
+ private Platform targetPlatform;
/**
* Default image builder constructor.
*
* @param root The image root directory.
@@ -149,15 +149,17 @@
}
@Override
public void storeFiles(ResourcePool files) {
try {
- this.targetOsName = files.moduleView().
- findModule("java.base").get().osName();
- if (this.targetOsName == null) {
+ String targetOsName = files.moduleView()
+ .findModule("java.base").get()
+ .osName();
+ if (targetOsName == null) {
throw new PluginException("ModuleTarget attribute is missing for java.base module");
}
+ this.targetPlatform = Platform.toPlatform(targetOsName);
checkResourcePool(files);
Path bin = root.resolve(BIN_DIRNAME);
@@ -474,11 +476,11 @@
return LIB_DIRNAME;
}
}
private boolean isWindows() {
- return targetOsName.startsWith("Windows");
+ return targetPlatform == Platform.WINDOWS;
}
/**
* chmod ugo+x file
*/
< prev index next >