< prev index next >
jdk/test/tools/lib/tests/JImageGenerator.java
Print this page
*** 336,345 ****
--- 336,349 ----
throw new AssertionError("Module check failed.");
}
}
public static class JModTask {
+ static final java.util.spi.ToolProvider JMOD_TOOL =
+ java.util.spi.ToolProvider.findFirst("jmod").orElseThrow(() ->
+ new RuntimeException("jmod tool not found")
+ );
private final List<Path> classpath = new ArrayList<>();
private final List<Path> libs = new ArrayList<>();
private final List<Path> cmds = new ArrayList<>();
private final List<Path> config = new ArrayList<>();
*** 475,485 ****
private Result cmd(String cmd) {
String[] args = optionsJMod(cmd);
System.err.println("jmod options: " + optionsPrettyPrint(args));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
! int exitCode = jdk.tools.jmod.Main.run(args, new PrintStream(baos));
String msg = new String(baos.toByteArray());
return new Result(exitCode, msg, output);
}
}
--- 479,490 ----
private Result cmd(String cmd) {
String[] args = optionsJMod(cmd);
System.err.println("jmod options: " + optionsPrettyPrint(args));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
! PrintStream ps = new PrintStream(baos);
! int exitCode = JMOD_TOOL.run(ps, ps, args);
String msg = new String(baos.toByteArray());
return new Result(exitCode, msg, output);
}
}
*** 554,563 ****
--- 559,572 ----
return cmd("extract", dir);
}
}
public static class JLinkTask {
+ static final java.util.spi.ToolProvider JLINK_TOOL =
+ java.util.spi.ToolProvider.findFirst("jlink").orElseThrow(() ->
+ new RuntimeException("jlink tool not found")
+ );
private final List<Path> jars = new ArrayList<>();
private final List<Path> jmods = new ArrayList<>();
private final List<Path> pluginModulePath = new ArrayList<>();
private final List<String> addMods = new ArrayList<>();
*** 689,707 ****
public Result call() {
String[] args = optionsJLink();
System.err.println("jlink options: " + optionsPrettyPrint(args));
StringWriter writer = new StringWriter();
! int exitCode = jdk.tools.jlink.internal.Main.run(args, new PrintWriter(writer));
return new Result(exitCode, writer.toString(), output);
}
public Result callPostProcess() {
String[] args = optionsPostProcessJLink();
System.err.println("jlink options: " + optionsPrettyPrint(args));
StringWriter writer = new StringWriter();
! int exitCode = jdk.tools.jlink.internal.Main.run(args, new PrintWriter(writer));
return new Result(exitCode, writer.toString(), output);
}
}
public static class InMemorySourceFile {
--- 698,718 ----
public Result call() {
String[] args = optionsJLink();
System.err.println("jlink options: " + optionsPrettyPrint(args));
StringWriter writer = new StringWriter();
! PrintWriter pw = new PrintWriter(writer);
! int exitCode = JLINK_TOOL.run(pw, pw, args);
return new Result(exitCode, writer.toString(), output);
}
public Result callPostProcess() {
String[] args = optionsPostProcessJLink();
System.err.println("jlink options: " + optionsPrettyPrint(args));
StringWriter writer = new StringWriter();
! PrintWriter pw = new PrintWriter(writer);
! int exitCode = JLINK_TOOL.run(pw, pw, args);
return new Result(exitCode, writer.toString(), output);
}
}
public static class InMemorySourceFile {
< prev index next >