--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -210,7 +210,7 @@
toolName,
"--version");
// not interested in the output
- IOUtils.exec(pb, Log.isDebug(), true);
+ IOUtils.exec(pb, true, null);
} catch (Exception e) {
Log.verbose(MessageFormat.format(I18N.getString(
"message.test-for-tool"), toolName, e.getMessage()));
@@ -807,7 +807,7 @@
FULL_PACKAGE_NAME.fetchFrom(params),
outFile.getAbsolutePath());
pb = pb.directory(DEB_IMAGE_DIR.fetchFrom(params).getParentFile());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
Log.verbose(MessageFormat.format(I18N.getString(
"message.output-to-location"), outFile.getAbsolutePath()));
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -154,7 +154,7 @@
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos)) {
ProcessBuilder pb = new ProcessBuilder(toolName, "--version");
- IOUtils.exec(pb, Log.isDebug(), false, ps);
+ IOUtils.exec(pb, false, ps);
//not interested in the above's output
String content = new String(baos.toByteArray());
Pattern pattern = Pattern.compile(" (\\d+\\.\\d+)");
@@ -636,7 +636,7 @@
"--define", "%_topdir " + broot.getAbsolutePath()
);
pb = pb.directory(RPM_IMAGE_DIR.fetchFrom(params));
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
Log.verbose(MessageFormat.format(
I18N.getString("message.output-bundle-location"),
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -38,7 +38,6 @@
import static jdk.jpackage.internal.StandardBundlerParam.*;
import static jdk.jpackage.internal.MacBaseInstallerBundler.*;
-import jdk.jpackage.internal.AbstractAppImageBuilder;
public class MacAppBundler extends AbstractImageBundler {
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Thu Jun 06 19:14:02 2019 -0400
@@ -761,7 +761,7 @@
args.add(keyChain);
ProcessBuilder pb = new ProcessBuilder(args);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
}
public static void restoreKeychainList(Map<String, ? super Object> params)
@@ -785,7 +785,7 @@
args.addAll(keyChains);
ProcessBuilder pb = new ProcessBuilder(args);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
}
public static void signAppBundle(
@@ -860,7 +860,7 @@
f.setWritable(true, true);
ProcessBuilder pb = new ProcessBuilder(args);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
Files.setPosixFilePermissions(p, oldPermissions);
} catch (IOException ioe) {
@@ -892,7 +892,7 @@
}
args.add(path.toString());
ProcessBuilder pb = new ProcessBuilder(args);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
args = new ArrayList<>();
args.addAll(Arrays.asList("codesign",
@@ -907,7 +907,7 @@
args.add(path.toString()
+ "/Contents/_CodeSignature/CodeResources");
pb = new ProcessBuilder(args);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
} catch (IOException e) {
toThrow.set(e);
}
@@ -951,7 +951,7 @@
ProcessBuilder pb =
new ProcessBuilder(args.toArray(new String[args.size()]));
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
}
}
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -193,7 +193,7 @@
pb = new ProcessBuilder(buildOptions);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
return finalPKG;
} catch (PackagerException pe) {
throw pe;
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -190,7 +190,7 @@
ProcessBuilder pb = new ProcessBuilder(searchOptions);
- IOUtils.exec(pb, verbose, false, ps);
+ IOUtils.exec(pb, false, ps);
Pattern p = Pattern.compile("\"alis\"<blob>=\"([^\"]+)\"");
Matcher m = p.matcher(baos.toString());
if (!m.find()) {
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java Thu Jun 06 19:14:02 2019 -0400
@@ -77,7 +77,7 @@
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos)) {
ProcessBuilder security = new ProcessBuilder(args);
- IOUtils.exec(security, verbose, false, ps);
+ IOUtils.exec(security, false, ps);
File output = File.createTempFile("tempfile", ".tmp");
@@ -105,7 +105,7 @@
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos)) {
ProcessBuilder security = new ProcessBuilder(args);
- IOUtils.exec(security, verbose, false, ps);
+ IOUtils.exec(security, false, ps);
String output = baos.toString();
output = output.substring(output.indexOf("=") + 1);
DateFormat df = new SimpleDateFormat(
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -76,7 +76,7 @@
Log.verbose(MessageFormat.format(
I18N.getString("message.running-script"),
configScript.getAbsolutePath()));
- IOUtils.run("bash", configScript, false);
+ IOUtils.run("bash", configScript);
}
return buildDMG(params, outdir);
@@ -291,7 +291,7 @@
"-ov", protoDMG.getAbsolutePath(),
"-fs", "HFS+",
"-format", "UDRW");
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
// mount temp image
pb = new ProcessBuilder(
@@ -300,7 +300,7 @@
protoDMG.getAbsolutePath(),
hdiUtilVerbosityFlag,
"-mountroot", imagesRoot.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
File mountedRoot =
new File(imagesRoot.getAbsolutePath(), APP_NAME.fetchFrom(p));
@@ -312,7 +312,7 @@
pb = new ProcessBuilder("osascript",
getConfig_VolumeScript(p).getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
// Indicate that we want a custom icon
// NB: attributes of the root directory are ignored
@@ -332,14 +332,14 @@
setFileUtility,
"-c", "icnC",
volumeIconFile.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
volumeIconFile.setReadOnly();
pb = new ProcessBuilder(
setFileUtility,
"-a", "C",
mountedRoot.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
} catch (IOException ex) {
Log.error(ex.getMessage());
Log.verbose("Cannot enable custom icon using SetFile utility");
@@ -355,7 +355,7 @@
"detach",
hdiUtilVerbosityFlag,
mountedRoot.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
// Compress it to a new image
pb = new ProcessBuilder(
@@ -365,7 +365,7 @@
hdiUtilVerbosityFlag,
"-format", "UDZO",
"-o", finalDMG.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
//add license if needed
if (getConfig_LicenseFile(p).exists()) {
@@ -375,7 +375,7 @@
"unflatten",
finalDMG.getAbsolutePath()
);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
//add license
pb = new ProcessBuilder(
@@ -385,7 +385,7 @@
"-xml",
getConfig_LicenseFile(p).getAbsolutePath()
);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
//hdiutil flatten your_image_file.dmg
pb = new ProcessBuilder(
@@ -393,7 +393,7 @@
"flatten",
finalDMG.getAbsolutePath()
);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
}
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -157,7 +157,7 @@
Log.verbose(MessageFormat.format(I18N.getString(
"message.running-script"),
configScript.getAbsolutePath()));
- IOUtils.run("bash", configScript, false);
+ IOUtils.run("bash", configScript);
}
return createPKG(params, outdir, appImageDir);
@@ -413,7 +413,7 @@
"--analyze",
cpl.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
patchCPLFile(cpl);
@@ -430,7 +430,7 @@
"--scripts",
SCRIPTS_DIR.fetchFrom(params).getAbsolutePath(),
appPKG.getAbsolutePath());
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
// build final package
File finalPKG = new File(outdir, INSTALLER_NAME.fetchFrom(params)
@@ -477,7 +477,7 @@
commandLine.add(finalPKG.getAbsolutePath());
pb = new ProcessBuilder(commandLine);
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
return finalPKG;
} catch (Exception ignored) {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Thu Jun 06 19:14:02 2019 -0400
@@ -42,7 +42,6 @@
import jdk.jpackage.internal.resources.ResourceLocator;
import static jdk.jpackage.internal.StandardBundlerParam.*;
-import static jdk.jpackage.internal.StandardBundlerParam.ARGUMENTS;
public abstract class AbstractAppImageBuilder {
@@ -51,13 +50,10 @@
private final Map<String, Object> properties;
private final Path root;
- protected List<String> excludeFileList = new ArrayList<>();
- public AbstractAppImageBuilder(Map<String, Object> properties,
- Path root) throws IOException {
+ public AbstractAppImageBuilder(Map<String, Object> properties, Path root) {
this.properties = properties;
this.root = root;
- excludeFileList.add(".*\\.diz");
}
public InputStream getResourceAsStream(String name) {
@@ -77,10 +73,6 @@
return this.root;
}
- public String getExcludeFileList() {
- return String.join(",", excludeFileList);
- }
-
protected void copyEntry(Path appDir, File srcdir, String fname)
throws IOException {
Path dest = appDir.resolve(fname);
@@ -182,7 +174,6 @@
public void writeCfgFile(Map<String, ? super Object> params,
File cfgFileName, String runtimeLocation) throws IOException {
cfgFileName.delete();
-
File mainJar = JLinkBundlerHelper.getMainJar(params);
ModFile.ModType mainJarType = ModFile.ModType.Unknown;
@@ -222,15 +213,6 @@
}
}
- Integer port = JLinkBundlerHelper.DEBUG.fetchFrom(params);
-
- if (port != null) {
- out.println(
- "app.debug=-agentlib:jdwp=transport=dt_socket,"
- + "server=y,suspend=y,address=localhost:"
- + port);
- }
-
out.println();
out.println("[JavaOptions]");
List<String> jvmargs = JAVA_OPTIONS.fetchFrom(params);
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Thu Jun 06 19:14:02 2019 -0400
@@ -132,7 +132,7 @@
});
}
- public Arguments(String[] args) throws PackagerException {
+ public Arguments(String[] args) {
argList = new ArrayList<String>(args.length);
for (String arg : args) {
argList.add(arg);
@@ -483,7 +483,7 @@
PLATFORM_LINUX;
}
- public boolean processArguments() throws Exception {
+ public boolean processArguments() {
try {
// init context of arguments
@@ -570,7 +570,7 @@
return generateBundle(bp.getBundleParamsAsMap());
} catch (Exception e) {
if (Log.isVerbose()) {
- throw e;
+ Log.verbose(e);
} else {
String msg1 = e.getMessage();
Log.error(msg1);
@@ -580,8 +580,8 @@
Log.error(msg2);
}
}
- return false;
}
+ return false;
}
}
@@ -767,20 +767,6 @@
return option;
}
- static Map<String, String> getArgumentMap(String inputString) {
- Map<String, String> map = new HashMap<>();
- List<String> list = getArgumentList(inputString);
- for (String pair : list) {
- int equals = pair.indexOf("=");
- if (equals != -1) {
- String key = pair.substring(0, equals);
- String value = pair.substring(equals+1, pair.length());
- map.put(key, value);
- }
- }
- return map;
- }
-
static Map<String, String> getPropertiesFromFile(String filename) {
Map<String, String> map = new HashMap<>();
// load properties file
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java Thu Jun 06 19:14:02 2019 -0400
@@ -149,10 +149,6 @@
putUnlessNullOrEmpty(JAVA_OPTIONS.getID(), jvmargs);
}
- public void setArguments(List<String> arguments) {
- putUnlessNullOrEmpty(ARGUMENTS.getID(), arguments);
- }
-
public void setAddModules(String value) {
putUnlessNull(StandardBundlerParam.ADD_MODULES.getID(), value);
}
@@ -169,10 +165,6 @@
putUnlessNull(StandardBundlerParam.MODULE.getID(), value);
}
- public void setDebug(String value) {
- putUnlessNull(JLinkBundlerHelper.DEBUG.getID(), value);
- }
-
public String getApplicationID() {
return fetchParam(IDENTIFIER);
}
@@ -239,10 +231,6 @@
return JAVA_OPTIONS.fetchFrom(params);
}
- public List<String> getArguments() {
- return ARGUMENTS.fetchFrom(params);
- }
-
public jdk.jpackage.internal.RelativeFileSet getAppResource() {
return fetchParam(APP_RESOURCES);
}
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java Thu Jun 06 19:14:02 2019 -0400
@@ -67,14 +67,12 @@
String applicationClass;
List<Param> params;
- List<String> arguments; //unnamed arguments
- // Java 9 modules support
+ // Java modules support
String addModules = null;
String limitModules = null;
String modulePath = null;
String module = null;
- String debugPort = null;
File outdir = null;
@@ -115,18 +113,6 @@
jvmargs.add(v);
}
- void setArguments(List<String> args) {
- this.arguments = args;
- }
-
- List<String> getArguments() {
- return this.arguments;
- }
-
- void addArgument(String arg) {
- this.arguments.add(arg);
- }
-
void addAddModule(String value) {
if (addModules == null) {
addModules = value;
@@ -157,10 +143,6 @@
this.module = value;
}
- void setDebug(String value) {
- this.debugPort = value;
- }
-
void setDescription(String description) {
this.description = description;
}
@@ -504,7 +486,6 @@
bundleParams.setDescription(description);
bundleParams.setJvmargs(jvmargs);
- bundleParams.setArguments(arguments);
if (addModules != null && !addModules.isEmpty()) {
bundleParams.setAddModules(addModules);
@@ -522,10 +503,6 @@
bundleParams.setMainModule(module);
}
- if (debugPort != null && !debugPort.isEmpty()) {
- bundleParams.setDebug(debugPort);
- }
-
Map<String, String> paramsMap = new TreeMap<>();
if (params != null) {
for (Param p : params) {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java Thu Jun 06 19:14:02 2019 -0400
@@ -191,29 +191,23 @@
}
// run "launcher paramfile" in the directory where paramfile is kept
- public static void run(String launcher, File paramFile, boolean verbose)
+ public static void run(String launcher, File paramFile)
throws IOException {
if (paramFile != null && paramFile.exists()) {
ProcessBuilder pb =
new ProcessBuilder(launcher, paramFile.getName());
pb = pb.directory(paramFile.getParentFile());
- exec(pb, verbose);
+ exec(pb);
}
}
- public static void exec(ProcessBuilder pb, boolean verbose)
+ public static void exec(ProcessBuilder pb)
throws IOException {
- exec(pb, verbose, false);
+ exec(pb, false, null);
}
- public static void exec(ProcessBuilder pb, boolean verbose,
- boolean testForPresenseOnly) throws IOException {
- exec(pb, verbose, testForPresenseOnly, null);
- }
-
- public static void exec(ProcessBuilder pb, boolean verbose,
- boolean testForPresenseOnly, PrintStream consumer)
- throws IOException {
+ public static void exec(ProcessBuilder pb, boolean testForPresenseOnly,
+ PrintStream consumer) throws IOException {
pb.redirectErrorStream(true);
Log.verbose("Running "
+ Arrays.toString(pb.command().toArray(new String[0]))
@@ -243,45 +237,20 @@
}
}
- @SuppressWarnings("unchecked")
- private static Process startProcess(Object... args) throws IOException {
- final ArrayList<String> argsList = new ArrayList<>();
- for (Object a : args) {
- if (a instanceof List) {
- argsList.addAll((List)a);
- } else if (a instanceof String) {
- argsList.add((String)a);
- }
- }
+ public static int getProcessOutput(List<String> result, String... args)
+ throws IOException, InterruptedException {
+
+ ProcessBuilder pb = new ProcessBuilder(args);
- return Runtime.getRuntime().exec(
- argsList.toArray(new String[argsList.size()]));
- }
+ final Process p = pb.start();
- private static void logErrorStream(Process p) {
+ List<String> list = new ArrayList<>();
+
+ final BufferedReader in =
+ new BufferedReader(new InputStreamReader(p.getInputStream()));
final BufferedReader err =
new BufferedReader(new InputStreamReader(p.getErrorStream()));
- Thread t = new Thread(() -> {
- try {
- String line;
- while ((line = err.readLine()) != null) {
- Log.error(line);
- }
- } catch (IOException ioe) {
- Log.verbose(ioe);
- }
- });
- t.setDaemon(true);
- t.start();
- }
- public static int getProcessOutput(List<String> result, Object... args)
- throws IOException, InterruptedException {
- final Process p = startProcess(args);
-
- List<String> list = new ArrayList<>();
- final BufferedReader in =
- new BufferedReader(new InputStreamReader(p.getInputStream()));
Thread t = new Thread(() -> {
try {
String line;
@@ -289,14 +258,21 @@
list.add(line);
}
} catch (IOException ioe) {
- jdk.jpackage.internal.Log.verbose(ioe);
+ Log.verbose(ioe);
+ }
+
+ try {
+ String line;
+ while ((line = err.readLine()) != null) {
+ Log.error(line);
+ }
+ } catch (IOException ioe) {
+ Log.verbose(ioe);
}
});
t.setDaemon(true);
t.start();
- logErrorStream(p);
-
int ret = p.waitFor();
result.clear();
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java Thu Jun 06 19:14:02 2019 -0400
@@ -73,16 +73,6 @@
private JLinkBundlerHelper() {}
- @SuppressWarnings("unchecked")
- static final BundlerParamInfo<Integer> DEBUG =
- new StandardBundlerParam<>(
- "-J-Xdebug",
- Integer.class,
- p -> null,
- (s, p) -> {
- return Integer.valueOf(s);
- });
-
static String listOfPathToString(List<Path> value) {
String result = "";
@@ -195,7 +185,6 @@
Set<String> limitModules =
StandardBundlerParam.LIMIT_MODULES.fetchFrom(params);
Path outputDir = imageBuilder.getRoot();
- String excludeFileList = imageBuilder.getExcludeFileList();
File mainJar = getMainJar(params);
ModFile.ModType mainJarType = ModFile.ModType.Unknown;
@@ -229,11 +218,8 @@
validModules.add(mainModule);
}
- Log.verbose(MessageFormat.format(
- I18N.getString("message.modules"), validModules.toString()));
-
runJLink(outputDir, modulePath, validModules, limitModules,
- excludeFileList, new HashMap<String,String>(), bindServices);
+ new HashMap<String,String>(), bindServices);
imageBuilder.prepareApplicationFiles();
}
@@ -387,7 +373,7 @@
}
private static void runJLink(Path output, List<Path> modulePath,
- Set<String> modules, Set<String> limitModules, String excludes,
+ Set<String> modules, Set<String> limitModules,
HashMap<String, String> user, boolean bindServices)
throws IOException {
@@ -410,10 +396,6 @@
args.add("--limit-modules");
args.add(getStringList(limitModules));
}
- if (excludes != null) {
- args.add("--exclude-files");
- args.add(excludes);
- }
if (user != null && !user.isEmpty()) {
for (Map.Entry<String, String> entry : user.entrySet()) {
args.add(entry.getKey());
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JPackageToolProvider.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JPackageToolProvider.java Thu Jun 06 19:14:02 2019 -0400
@@ -43,9 +43,9 @@
public synchronized int run(
PrintWriter out, PrintWriter err, String... args) {
try {
- return jdk.jpackage.main.Main.run(out, err, args);
+ return new jdk.jpackage.main.Main().execute(out, err, args);
} catch (Exception ignored) {
- return -1;
+ return 1;
}
}
}
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Thu Jun 06 19:14:02 2019 -0400
@@ -25,9 +25,6 @@
package jdk.jpackage.internal;
-import jdk.jpackage.internal.BundleParams;
-import jdk.jpackage.internal.AbstractAppImageBuilder;
-
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
@@ -242,7 +239,7 @@
Arguments.CLIOptions.ARGUMENTS.getId(),
(Class<List<String>>) (Object) List.class,
params -> Collections.emptyList(),
- (s, p) -> splitStringWithEscapes(s)
+ (s, p) -> null
);
@SuppressWarnings("unchecked")
@@ -657,27 +654,6 @@
}
}
- private static List<String> splitStringWithEscapes(String s) {
- List<String> l = new ArrayList<>();
- StringBuilder current = new StringBuilder();
- boolean quoted = false;
- boolean escaped = false;
- for (char c : s.toCharArray()) {
- if (escaped) {
- current.append(c);
- } else if ('"' == c) {
- quoted = !quoted;
- } else if (!quoted && Character.isWhitespace(c)) {
- l.add(current.toString());
- current = new StringBuilder();
- } else {
- current.append(c);
- }
- }
- l.add(current.toString());
- return l;
- }
-
private static List<RelativeFileSet>
createAppResourcesListFromString(String s,
Map<String, ? super Object> objectObjectMap) {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Thu Jun 06 19:14:02 2019 -0400
@@ -35,8 +35,6 @@
message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}).
message.using-custom-resource=Using custom package resource {0} (loaded from {1}).
message.creating-app-bundle=Creating app bundle: {0} in {1}.
-message.detected.modules=Automatically adding detected modules: {0}.
-message.modules=Adding modules: {0} to runtime image.
message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists.
message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists.
message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}: {1} does not exists.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java Thu Jun 06 19:14:02 2019 -0400
@@ -35,6 +35,13 @@
import java.util.List;
/**
+ * This file is direct copy of CommandLine.java in com.sun.tools.javac.main.
+ * It should not be modified other than the package declaration above,
+ * the copyright year and this comment.
+ * It should track changes made to that file.
+ */
+
+/**
* Various utility methods for processing Java tool command line arguments.
*
* <p><b>This is NOT part of any supported API.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/Main.java Thu Jun 06 19:14:02 2019 -0400
@@ -30,6 +30,7 @@
import jdk.jpackage.internal.CLIHelp;
import java.io.PrintWriter;
import java.util.ResourceBundle;
+import java.io.IOException;
public class Main {
@@ -50,65 +51,60 @@
Log.Logger logger = new Log.Logger(false);
Log.setLogger(logger);
- int status = run(args);
+ int status = new jdk.jpackage.main.Main().execute(args);
System.exit(status);
}
/**
- * run() - this is the entry point for the ToolProvider API.
+ * execute() - this is the entry point for the ToolProvider API.
*
* @param out output stream
* @param err error output stream
* @param args command line arguments
* @return an exit code. 0 means success, non-zero means an error occurred.
*/
- public static int run(PrintWriter out, PrintWriter err, String... args)
- throws Exception {
+ public int execute(PrintWriter out, PrintWriter err, String... args) {
// Create logger with provided streams
Log.Logger logger = new Log.Logger(false);
logger.setPrintWriter(out, err);
Log.setLogger(logger);
- int status = run(args);
- Log.flush();
- return status;
+ return execute(args);
}
- private static int run(String... args) throws Exception {
- String[] newArgs = CommandLine.parse(args);
- if (newArgs.length == 0) {
- CLIHelp.showHelp(true);
- } else if (hasHelp(newArgs)){
- if (hasVersion(newArgs)) {
- Log.info(version + "\n");
+ private int execute(String... args) {
+ try {
+ String[] newArgs;
+ try {
+ newArgs = CommandLine.parse(args);
+ } catch (IOException ioe) {
+ Log.error(ioe.getMessage());
+ return 1;
}
- CLIHelp.showHelp(false);
- } else if (hasVersion(newArgs)) {
- Log.info(version);
- } else {
- try {
+
+ if (newArgs.length == 0) {
+ CLIHelp.showHelp(true);
+ } else if (hasHelp(newArgs)){
+ if (hasVersion(newArgs)) {
+ Log.info(version + "\n");
+ }
+ CLIHelp.showHelp(false);
+ } else if (hasVersion(newArgs)) {
+ Log.info(version);
+ } else {
Arguments arguments = new Arguments(newArgs);
if (!arguments.processArguments()) {
- // processArguments() should log error message if failed.
- return -1;
+ // processArguments() will log error message if failed.
+ return 1;
}
- } catch (Exception e) {
- if (Log.isVerbose()) {
- Log.verbose(e);
- } else {
- Log.error(e.getMessage());
- if (e.getCause() != null && e.getCause() != e) {
- Log.error(e.getCause().getMessage());
- }
- }
- return -1;
}
+ return 0;
+ } finally {
+ Log.flush();
}
-
- return 0;
}
- private static boolean hasHelp(String[] args) {
+ private boolean hasHelp(String[] args) {
for (String a : args) {
if ("--help".equals(a) || "-h".equals(a)) {
return true;
@@ -117,7 +113,7 @@
return false;
}
- private static boolean hasVersion(String[] args) {
+ private boolean hasVersion(String[] args) {
for (String a : args) {
if ("--version".equals(a)) {
return true;
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExeBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -188,7 +188,7 @@
"/?");
VersionExtractor ve =
new VersionExtractor("Inno Setup (\\d+.?\\d*)");
- IOUtils.exec(pb, Log.isDebug(), true, ve);
+ IOUtils.exec(pb, true, ve);
// not interested in the output
String version = ve.getVersion();
Log.verbose(MessageFormat.format(
@@ -388,7 +388,7 @@
Log.verbose(MessageFormat.format(
getString("message.running-wsh-script"),
configScript.getAbsolutePath()));
- IOUtils.run("wscript", configScript, VERBOSE.fetchFrom(p));
+ IOUtils.run("wscript", configScript);
}
return buildEXE(p, outdir);
}
@@ -778,7 +778,7 @@
"/o"+outdir.getAbsolutePath(),
getConfig_ExeProjectFile(p).getAbsolutePath());
pb = pb.directory(EXE_IMAGE_DIR.fetchFrom(p));
- IOUtils.exec(pb, VERBOSE.fetchFrom(p));
+ IOUtils.exec(pb);
Log.verbose(MessageFormat.format(
getString("message.output-location"),
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java Thu Jun 06 19:14:02 2019 -0400
@@ -229,7 +229,7 @@
"/?");
VersionExtractor ve = new VersionExtractor("version (\\d+.\\d+)");
// not interested in the output
- IOUtils.exec(pb, Log.isDebug(), true, ve);
+ IOUtils.exec(pb, true, ve);
String version = ve.getVersion();
Log.verbose(MessageFormat.format(
I18N.getString("message.tool-version"),
@@ -479,8 +479,7 @@
Log.verbose(MessageFormat.format(
I18N.getString("message.running-wsh-script"),
configScript.getAbsolutePath()));
- IOUtils.run("wscript",
- configScript, false);
+ IOUtils.run("wscript", configScript);
}
return buildMSI(p, outdir);
}
@@ -1086,7 +1085,7 @@
"-ext", "WixUtilExtension",
"-out", candleOut.getAbsolutePath());
pb = pb.directory(WIN_APP_IMAGE.fetchFrom(params));
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
Log.verbose(MessageFormat.format(I18N.getString(
"message.generating-msi"), msiOut.getAbsolutePath()));
@@ -1125,7 +1124,7 @@
pb = new ProcessBuilder(commandLine);
pb = pb.directory(WIN_APP_IMAGE.fetchFrom(params));
- IOUtils.exec(pb, false);
+ IOUtils.exec(pb);
candleOut.delete();
IOUtils.deleteRecursive(tmpDir);
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java Thu Jun 06 19:10:12 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java Thu Jun 06 19:14:02 2019 -0400
@@ -34,8 +34,6 @@
import java.util.ArrayList;
import java.util.List;
-import static jdk.jpackage.internal.IOUtils.exec;
-
final class WindowsRegistry {
// Currently we only support HKEY_LOCAL_MACHINE. Native implementation will
--- a/test/jdk/tools/launcher/HelpFlagsTest.java Thu Jun 06 19:10:12 2019 -0400
+++ b/test/jdk/tools/launcher/HelpFlagsTest.java Thu Jun 06 19:14:02 2019 -0400
@@ -161,7 +161,7 @@
new ToolHelpSpec("rmiregistry", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways.
new ToolHelpSpec("serialver", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways.
new ToolHelpSpec("unpack200", 1, 1, 1, 0, 1, 0, 2), // -?, -h, --help, -help accepted but not documented.
- new ToolHelpSpec("jpackage", 0, 1, 1, 0, 0, 1, 255), // -h, --help,
+ new ToolHelpSpec("jpackage", 0, 1, 1, 0, 0, 1, 1), // -h, --help,
};
// Returns true if the file is not a tool.