提交 15d1ffe2 编写于 作者: K Kohsuke Kawaguchi

normalizing the options handling

上级 e7cc1410
......@@ -225,11 +225,14 @@ public class JDKInstaller extends ToolInstaller {
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(jdkBundle);
args.add("/s");
if (isJava15() || isJava14()) {
args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\\\""+ expectedLocation +"\\\" /L \\\""+logFile+"\\\"");
} else {
// modern version supports arguments in more sane format.
args.add("/s","/v","/qn","/L","\\\""+logFile+"\\\"","REBOOT=ReallySuppress","INSTALLDIR=\\\""+ expectedLocation+"\\\"");
}
// according to http://community.acresso.com/showthread.php?t=83301, \" is the trick to quote values with whitespaces.
// Oh Windows, oh windows, why do you have to be so difficult?
args.add("/v/qn REBOOT=ReallySuppress INSTALLDIR=\\\""+ expectedLocation +"\\\" /L \\\""+logFile+"\\\"");
int r = launcher.launch().cmds(args).stdout(out)
.pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
if (r != 0) {
......@@ -250,6 +253,14 @@ public class JDKInstaller extends ToolInstaller {
}
}
private boolean isJava15() {
return id.contains("-1.5");
}
private boolean isJava14() {
return id.contains("-1.4");
}
/**
* Abstraction of the file system to perform JDK installation.
* Consider {@link FilePathFileSystem} as the canonical documentation of the contract.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册