OpenJDK / jigsaw / jake / jdk
changeset 14168:2b6cb5de27d5
Add short option for printing module descriptor to jar tool
author | chegar |
---|---|
date | Thu, 01 Oct 2015 14:40:45 +0100 |
parents | 4b16ae395bbe |
children | 521434b30dce |
files | src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties test/tools/jar/modularJar/Basic.java |
diffstat | 3 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java Thu Oct 01 11:16:01 2015 +0100 +++ b/src/jdk.jartool/share/classes/sun/tools/jar/GNUStyleOptions.java Thu Oct 01 14:40:45 2015 +0100 @@ -91,7 +91,7 @@ tool.xflag = true; } }, - new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor") { + new Option(false, OptionType.MAIN_OPERATION, "--print-module-descriptor", "-p") { void process(Main tool, String opt, String arg) throws BadArgs { if (tool.cflag || tool.iflag || tool.tflag || tool.uflag || tool.xflag) throw new BadArgs("error.multiple.main.operations").showUsage(true);
--- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties Thu Oct 01 11:16:01 2015 +0100 +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties Thu Oct 01 14:40:45 2015 +0100 @@ -152,7 +152,7 @@ main.help.opt.main.extract=\ \ -x, --extract Extract named (or all) files from the archive main.help.opt.main.print-module-descriptor=\ -\ , --print-module-descriptor Print the module descriptor +\ -p, --print-module-descriptor Print the module descriptor main.help.opt.any=\ \ Operation modifiers valid in any mode:\n\ \n\
--- a/test/tools/jar/modularJar/Basic.java Thu Oct 01 11:16:01 2015 +0100 +++ b/test/tools/jar/modularJar/Basic.java Thu Oct 01 14:40:45 2015 +0100 @@ -503,14 +503,17 @@ "--no-manifest", "-C", modClasses.toString(), ".") .assertSuccess(); - jar("--print-module-descriptor", - "--file=" + modularJar.toString()) - .assertSuccess() - .resultChecker( r -> - assertTrue(r.output.contains(FOO.moduleName + "@" + FOO.version), - "Expected to find ", FOO.moduleName + "@" + FOO.version, - " in [", r.output, "]") - ); + + for (String option : new String[] {"--print-module-descriptor", "-p" }) { + jar(option, + "--file=" + modularJar.toString()) + .assertSuccess() + .resultChecker(r -> + assertTrue(r.output.contains(FOO.moduleName + "@" + FOO.version), + "Expected to find ", FOO.moduleName + "@" + FOO.version, + " in [", r.output, "]") + ); + } } // -- Infrastructure