--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Wed Dec 05 12:23:37 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Wed Dec 05 17:03:58 2018 -0500
@@ -512,7 +512,20 @@
}
private void initArgumentList(String[] args) {
- argList = new ArrayList<>(Arrays.asList(args));
+ argList = new ArrayList<String>(args.length);
+ for (String arg : args) {
+ if (arg.startsWith("@")) {
+ if (arg.length() > 1) {
+ String filename = arg.substring(1);
+ argList.addAll(extractArgList(filename));
+ } else {
+ Log.error("Illegal argument ["+arg+"]");
+ }
+ } else {
+ argList.add(arg);
+ }
+ }
+ Log.debug ("\nJPackage argument list: \n" + argList + "\n");
pos = 0;
deployParams = new DeployParams();
@@ -523,6 +536,46 @@
secondaryLaunchers = new ArrayList<>();
}
+ private List<String> extractArgList(String filename) {
+ List<String> args = new ArrayList<String>();
+ try {
+ File f = new File(filename);
+ if (f.exists()) {
+ List<String> lines = Files.readAllLines(f.toPath());
+ for (String line : lines) {
+ String [] qsplit;
+ String quote = "\"";
+ if (line.contains("\"")) {
+ qsplit = line.split("\"");
+ } else {
+ qsplit = line.split("\'");
+ quote = "\'";
+ }
+ for (int i=0; i<qsplit.length; i++) {
+ // every other qsplit of line is a quoted string
+ if ((i & 1) == 0) {
+ // non-quoted string - split by whitespace
+ String [] newargs = qsplit[i].split("\\s");
+ for (String newarg : newargs) {
+ args.add(newarg);
+ }
+ } else {
+ // quoted string - don't split by whitespace
+ args.add(qsplit[i]);
+ }
+ }
+ }
+ } else {
+ Log.error("Can not find argument file: " + f);
+ }
+ } catch (IOException ioe) {
+ Log.verbose(ioe.getMessage());
+ Log.verbose(ioe);
+ }
+ return args;
+ }
+
+
public boolean processArguments() throws Exception {
try {
@@ -534,8 +587,8 @@
CLIOptions option;
for (; CLIOptions.hasNextArg(); CLIOptions.nextArg()) {
arg = CLIOptions.getArg();
- // check if it's a CLI option
if ((option = toCLIOption(arg)) != null) {
+ // found a CLI option
allOptions.add(option);
option.execute();
} else {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Wed Dec 05 12:23:37 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Wed Dec 05 17:03:58 2018 -0500
@@ -56,6 +56,8 @@
Generates a Server JRE installer.\n\
\n\
The following options are valid for all platforms:\n\
+\ @<filename> \n\
+\ read options and mode from file. \n\
\ --help -h \n\
\ Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
\ If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Wed Dec 05 12:23:37 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Wed Dec 05 17:03:58 2018 -0500
@@ -56,6 +56,8 @@
Generates a Server JRE installer.\n\
\n\
The following options are valid for all platforms:\n\
+\ @<filename> \n\
+\ read options and mode from file. \n\
\ --help -h \n\
\ Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
\ If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Wed Dec 05 12:23:37 2018 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Wed Dec 05 17:03:58 2018 -0500
@@ -56,6 +56,8 @@
Generates a Server JRE installer.\n\
\n\
The following options are valid for all platforms:\n\
+\ @<filename> \n\
+\ read options and mode from file. \n\
\ --help -h \n\
\ Shows the usage text, followed by a list and description of each valid option for the current platform and the given mode.\n\
\ If no mode is given, shows the usage text, followed by a list and description of each valid option for the current platform.\n\