8234867: Issue warning for mutually exclusive options on jpackage command line

Reviewed-by: prr, asemenyuk, almatvee
This commit is contained in:
Andy Herrick 2019-12-10 08:15:45 -05:00
parent 28099d76b2
commit 2c772c7887
4 changed files with 21 additions and 5 deletions

View File

@ -565,11 +565,24 @@ public class Arguments {
}
}
}
if (installerOnly && hasRuntime) {
// note --runtime-image is only for image or runtime installer.
throw new PackagerException("ERR_InvalidTypeOption",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
ptype);
if (hasRuntime) {
if (hasAppImage) {
// note --runtime-image is only for image or runtime installer.
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.PREDEFINED_APP_IMAGE.getIdWithPrefix());
}
if (allOptions.contains(CLIOptions.ADD_MODULES)) {
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.ADD_MODULES.getIdWithPrefix());
}
if (allOptions.contains(CLIOptions.BIND_SERVICES)) {
throw new PackagerException("ERR_MutuallyExclusiveOptions",
CLIOptions.PREDEFINED_RUNTIME_IMAGE.getIdWithPrefix(),
CLIOptions.BIND_SERVICES.getIdWithPrefix());
}
}
if (hasMainJar && hasMainModule) {
throw new PackagerException("ERR_BothMainJarAndModule");

View File

@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]
ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found

View File

@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]
ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found

View File

@ -72,6 +72,7 @@ ERR_NoMainClass=Error: Main application class is missing
ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform
ERR_InvalidTypeOption=Error: Option [{0}] is not valid with type [{1}]
ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option
ERR_MutuallyExclusiveOptions="Error: Mutually exclusive options [{0}] and [{1}]
ERR_MissingArgument=Error: Missing argument: {0}
ERR_MissingAppResources=Error: No application jars found