提交 026493c1 authored 作者: Tomas Pospichal's avatar Tomas Pospichal

Ensure the build executes java from the current JRE

上级 fb9452c6
......@@ -12,8 +12,9 @@ import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.h2.build.code.SwitchSource;
import org.h2.build.doc.XMLParser;
......@@ -69,14 +70,14 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/mysql-connector-java-5.1.6.jar";
StringList args = args("-Xmx128m",
"-cp", cp, "org.h2.test.bench.TestPerformance");
exec("java", args.plus("-init", "-db", "1"));
exec("java", args.plus("-db", "2"));
exec("java", args.plus("-db", "3", "-out", "pe.html"));
exec("java", args.plus("-init", "-db", "4"));
exec("java", args.plus("-db", "5", "-exit"));
exec("java", args.plus("-db", "6"));
exec("java", args.plus("-db", "7"));
exec("java", args.plus("-db", "8", "-out", "ps.html"));
execJava(args.plus("-init", "-db", "1"));
execJava(args.plus("-db", "2"));
execJava(args.plus("-db", "3", "-out", "pe.html"));
execJava(args.plus("-init", "-db", "4"));
execJava(args.plus("-db", "5", "-exit"));
execJava(args.plus("-db", "6"));
execJava(args.plus("-db", "7"));
execJava(args.plus("-db", "8", "-out", "ps.html"));
}
/**
......@@ -132,10 +133,9 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/jts-core-1.14.0.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/slf4j-nop-1.6.0.jar" +
File.pathSeparator + System.getProperty("java.home") +
"/../lib/tools.jar";
File.pathSeparator + javaToolsJar;
// -XX:-UseSplitVerifier is for Java 7 compatibility
exec("java", args(
execJava(args(
"-Xmx128m",
"-XX:-UseSplitVerifier",
"-cp", cp, "emma", "run",
......@@ -209,7 +209,7 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/org.osgi.core-4.2.0.jar" +
File.pathSeparator + "ext/org.osgi.enterprise-4.2.0.jar" +
File.pathSeparator + "ext/jts-core-1.14.0.jar" +
File.pathSeparator + System.getProperty("java.home") + "/../lib/tools.jar";
File.pathSeparator + javaToolsJar;
FileList files;
if (clientOnly) {
files = files("src/main/org/h2/Driver.java");
......@@ -610,8 +610,7 @@ public class Build extends BuildBase {
"-noindex",
"-tag", "h2.resource",
"-d", "docs/javadocImpl2",
"-classpath", System.getProperty("java.home") +
"/../lib/tools.jar" +
"-classpath", javaToolsJar +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
......@@ -626,8 +625,7 @@ public class Build extends BuildBase {
"-noindex",
"-tag", "h2.resource",
"-d", "docs/javadocImpl3",
"-classpath", System.getProperty("java.home") +
"/../lib/tools.jar" +
"-classpath", javaToolsJar +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
......@@ -642,8 +640,7 @@ public class Build extends BuildBase {
javadoc("-sourcepath", "src/main" +
File.pathSeparator + "src/test" +
File.pathSeparator + "src/tools",
"-classpath",
System.getProperty("java.home") + "/../lib/tools.jar" +
"-classpath", javaToolsJar +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/servlet-api-3.0.1.jar" +
File.pathSeparator + "ext/lucene-core-3.0.2.jar" +
......@@ -922,15 +919,14 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/jts-core-1.14.0.jar" +
File.pathSeparator + "ext/slf4j-api-1.6.0.jar" +
File.pathSeparator + "ext/slf4j-nop-1.6.0.jar" +
File.pathSeparator + System.getProperty("java.home") +
"/../lib/tools.jar";
File.pathSeparator + javaToolsJar;
if (fast) {
exec("java", args(
execJava(args(
"-Xmx128m",
"-cp", cp,
"org.h2.test.TestAll", "fast"));
} else {
exec("java", args(
execJava(args(
"-Xmx128m",
"-cp", cp,
"org.h2.test.TestAll"));
......@@ -1077,7 +1073,7 @@ public class Build extends BuildBase {
javac(args, files);
String cp = "bin" + File.pathSeparator + "temp" +
File.pathSeparator + "ext/h2mig_pagestore_addon.jar";
exec("java", args("-Xmx512m", "-cp", cp,
execJava(args("-Xmx512m", "-cp", cp,
"-Dh2.ftpPassword=" + password,
"org.h2.build.doc.UploadBuild"));
}
......
......@@ -41,6 +41,7 @@ import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* This class is a complete pure Java build tool. It allows to build this
* project without any external dependencies except a JDK.
......@@ -173,6 +174,18 @@ public class BuildBase {
*/
protected boolean quiet;
/**
* The full path to the executable of the current JRE.
*/
protected String javaExecutable = System.getProperty("java.home") +
File.separator + "bin" + File.separator + "java";
/**
* The full path to the tools jar of the current JDK.
*/
protected String javaToolsJar = System.getProperty("java.home") + File.separator + ".." +
File.separator + "lib" + File.separator + "tools.jar";
/**
* This method should be called by the main method.
*
......@@ -341,6 +354,16 @@ public class BuildBase {
return exec(script, args);
}
/**
* Execute java in a separate process, but using the java executable of the current JRE.
*
* @param args the command line parameters for the java command
* @return the exit value
*/
protected int execJava(StringList args) {
return exec(javaExecutable, args);
}
/**
* Execute a program in a separate process.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论