提交 0a3590f0 authored 作者: Thomas Mueller's avatar Thomas Mueller

Require Java 1.5 compiler

上级 a8fec820
......@@ -16,9 +16,10 @@ PATH=$JAVA16/bin:$PATH
./build.sh -quiet spellcheck javadocImpl jarClient
echo $(date "+%H:%M:%S") JDK 1.4
JAVA_HOME=$JAVA14
PATH=$JAVA14/bin:$PATH
./build.sh -quiet clean compile
export BCP=/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Classes
JAVA_HOME=$JAVA15
PATH=$JAVA15/bin:$PATH
./build.sh -quiet clean -Dversion=1.4 switchSource -Dbcp=$BCP/classes.jar:$BCP/jsse.jar compile
./build.sh -quiet installer mavenDeployCentral
# ./build.sh -quiet compile benchmark
......
......@@ -61,14 +61,15 @@ public class Build extends BuildBase {
"ext/derbynet-10.4.2.0.jar" + File.pathSeparator +
"ext/postgresql-8.3-603.jdbc3.jar" + File.pathSeparator +
"ext/mysql-connector-java-5.1.6.jar";
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-init", "-db", "1"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "2"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "3", "-out", "pe.html"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-init", "-db", "4"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "5", "-exit"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "6"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "7"});
exec("java", new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance", "-db", "8", "-out", "ps.html"});
StringList args = new StringList(new String[]{"-Xmx128m", "-cp", cp, "org.h2.test.bench.TestPerformance"});
exec("java", args.plus(new String[]{"-init", "-db", "1"}));
exec("java", args.plus(new String[]{"-db", "2"}));
exec("java", args.plus(new String[]{"-db", "3", "-out", "pe.html"}));
exec("java", args.plus(new String[]{"-init", "-db", "4"}));
exec("java", args.plus(new String[]{"-db", "5", "-exit"}));
exec("java", args.plus(new String[]{"-db", "6"}));
exec("java", args.plus(new String[]{"-db", "7"}));
exec("java", args.plus(new String[]{"-db", "8", "-out", "ps.html"}));
}
/**
......@@ -103,12 +104,12 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + "ext/org.osgi.core-1.2.0.jar" +
File.pathSeparator + "ext/slf4j-api-1.5.0.jar";
exec("java", new String[] { "-Xmx128m", "-cp", cp, "emma", "run",
exec("java", new StringList(new String[] { "-Xmx128m", "-cp", cp, "emma", "run",
"-cp", "temp",
"-sp", "src/main",
"-r", "html,txt",
"-ix", "-org.h2.test.*,-org.h2.dev.*,-org.h2.jaqu.*,-org.h2.index.Page*,-org.h2.mode.*",
"org.h2.test.TestAll" });
"org.h2.test.TestAll" }));
}
/**
......@@ -116,7 +117,12 @@ public class Build extends BuildBase {
*/
public void switchSource() {
try {
SwitchSource.main(new String[] { "-dir", "src", "-auto" });
String version = System.getProperty("version");
if (version == null) {
SwitchSource.main(new String[] { "-dir", "src", "-auto" });
} else {
SwitchSource.main(new String[] { "-dir", "src", "-version", version });
}
} catch (IOException e) {
throw new Error(e);
}
......@@ -141,11 +147,18 @@ public class Build extends BuildBase {
} else {
files = getFiles("src/main");
}
StringList args = new StringList();
if (System.getProperty("version") != null) {
String bcp = System.getProperty("bcp");
// /System/Library/Frameworks/JavaVM.framework/Versions/1.4/Classes/classes.jar
args = args.plus(new String[] { "-source", "1.5", "-target", "jsr14", "-bootclasspath", bcp});
}
if (debugInfo) {
javac(new String[] { "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files);
args = args.plus(new String[] { "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath});
} else {
javac(new String[] { "-g:none", "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath }, files);
args = args.plus(new String[] { "-g:none", "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath });
}
javac(args, files);
files = getFiles("src/main/META-INF/services");
copy("temp", files, "src/main");
......@@ -153,8 +166,9 @@ public class Build extends BuildBase {
if (!clientOnly) {
files = getFiles("src/test");
files.addAll(getFiles("src/tools"));
javac(new String[] { "-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools",
"-classpath", classpath }, files);
args = new StringList(new String[] { "-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools",
"-classpath", classpath });
javac(args, files);
files = getFiles("src/test").
exclude("*.java").
exclude("*/package.html");
......@@ -229,7 +243,7 @@ public class Build extends BuildBase {
delete(getFiles("bin").keep("*.jar"));
jar();
docs();
exec("soffice", new String[]{"-invisible", "macro:///Standard.Module1.H2Pdf"});
exec("soffice", new StringList(new String[]{"-invisible", "macro:///Standard.Module1.H2Pdf"}));
copy("docs", getFiles("../h2web/h2.pdf"), "../h2web");
delete("docs/html/onePage.html");
FileList files = getFiles("../h2").keep("../h2/build.*");
......@@ -240,7 +254,7 @@ public class Build extends BuildBase {
zip("../h2web/h2.zip", files, "../", false, false);
boolean installer = false;
try {
exec("makensis", new String[]{"/v2", "src/installer/h2.nsi"});
exec("makensis", new StringList(new String[]{"/v2", "src/installer/h2.nsi"}));
installer = true;
} catch (Error e) {
print("NSIS is not available: " + e);
......@@ -339,11 +353,11 @@ public class Build extends BuildBase {
public void javadoc() {
delete("docs");
mkdir("docs/javadoc");
javadoc(new String[] { "-sourcepath", "src/main", "org.h2.jdbc", "org.h2.jdbcx",
javadoc(new StringList(new String[] { "-sourcepath", "src/main", "org.h2.jdbc", "org.h2.jdbcx",
"org.h2.tools", "org.h2.api", "org.h2.constant", "org.h2.fulltext",
"-doclet", "org.h2.build.doclet.Doclet",
"-classpath",
"ext/lucene-core-2.2.0.jar"});
"ext/lucene-core-2.2.0.jar"}));
copy("docs/javadoc", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc");
}
......@@ -352,7 +366,7 @@ public class Build extends BuildBase {
*/
public void javadocImpl() {
mkdir("docs/javadocImpl2");
javadoc(new String[] {
javadoc(new StringList(new String[] {
"-sourcepath", "src/main" + File.pathSeparator +
"src/test" + File.pathSeparator + "src/tools" ,
"-noindex",
......@@ -365,11 +379,11 @@ public class Build extends BuildBase {
File.pathSeparator + "ext/lucene-core-2.2.0.jar" +
File.pathSeparator + "ext/org.osgi.core-1.2.0.jar",
"-subpackages", "org.h2",
"-exclude", "org.h2.test.jaqu:org.h2.jaqu" });
"-exclude", "org.h2.test.jaqu:org.h2.jaqu" }));
System.setProperty("h2.interfacesOnly", "false");
System.setProperty("h2.destDir", "docs/javadocImpl");
javadoc(new String[] {
javadoc(new StringList(new String[] {
"-sourcepath", "src/main" + File.pathSeparator + "src/test" + File.pathSeparator + "src/tools",
"-classpath", System.getProperty("java.home") + "/../lib/tools.jar" +
File.pathSeparator + "ext/slf4j-api-1.5.0.jar" +
......@@ -379,7 +393,7 @@ public class Build extends BuildBase {
"-subpackages", "org.h2",
"-exclude", "org.h2.test.jaqu:org.h2.jaqu",
"-package",
"-doclet", "org.h2.build.doclet.Doclet" });
"-doclet", "org.h2.build.doclet.Doclet" }));
copy("docs/javadocImpl", getFiles("src/docsrc/javadoc"), "src/docsrc/javadoc");
}
......@@ -406,7 +420,7 @@ public class Build extends BuildBase {
String pom = new String(readFile(new File("src/installer/pom.xml")));
pom = replaceAll(pom, "@version@", getVersion());
writeFile(new File("bin/pom.xml"), pom.getBytes());
execScript("mvn", new String[] {
execScript("mvn", new StringList(new String[] {
"deploy:deploy-file",
"-Dfile=bin/h2" + getJarSuffix(),
"-Durl=file:///data/h2database/m2-repo",
......@@ -414,7 +428,7 @@ public class Build extends BuildBase {
"-Dversion=" + getVersion(),
"-DpomFile=bin/pom.xml",
"-DartifactId=h2",
"-DgroupId=com.h2database" });
"-DgroupId=com.h2database" }));
}
/**
......@@ -426,20 +440,20 @@ public class Build extends BuildBase {
String pom = new String(readFile(new File("src/installer/pom.xml")));
pom = replaceAll(pom, "@version@", "1.0-SNAPSHOT");
writeFile(new File("bin/pom.xml"), pom.getBytes());
execScript("mvn", new String[] {
execScript("mvn", new StringList(new String[] {
"install:install-file",
"-Dversion=1.0-SNAPSHOT",
"-Dfile=bin/h2" + getJarSuffix(),
"-Dpackaging=jar",
"-DpomFile=bin/pom.xml",
"-DartifactId=h2",
"-DgroupId=com.h2database" });
"-DgroupId=com.h2database" }));
}
private void resources(boolean clientOnly, boolean basicOnly) {
if (!clientOnly) {
javadoc(new String[] { "-sourcepath", "src/main", "org.h2.tools",
"-doclet", "org.h2.build.doclet.ResourceDoclet"});
javadoc(new StringList(new String[] { "-sourcepath", "src/main", "org.h2.tools",
"-doclet", "org.h2.build.doclet.ResourceDoclet"}));
}
FileList files = getFiles("src/main").
exclude("*.MF").
......@@ -555,9 +569,9 @@ public class Build extends BuildBase {
throw new Error("h2.ftpPassword not set");
}
String cp = "bin" + File.pathSeparator + "temp";
exec("java", new String[] { "-Xmx128m", "-cp", cp,
exec("java", new StringList(new String[] { "-Xmx128m", "-cp", cp,
"-Dh2.ftpPassword=" + password,
"org.h2.build.doc.UploadBuild" });
"org.h2.build.doc.UploadBuild" }));
}
/**
......
......@@ -43,12 +43,69 @@ import java.util.zip.ZipOutputStream;
*/
public class BuildBase {
/**
* A list of strings.
*/
public static class StringList extends ArrayList implements List {
private static final long serialVersionUID = 1L;
StringList() {
super();
}
StringList(String[] args) {
super();
addAll(Arrays.asList(args));
}
/**
* Add a list of strings.
*
* @param args the list to add
* @return the new list
*/
public StringList plus(String[] args) {
StringList newList = new StringList();
newList.addAll(this);
newList.addAll(Arrays.asList(args));
return newList;
}
/**
* Add a string.
*
* @param s the string to add
* @return the new list
*/
public StringList plus(String s) {
StringList newList = new StringList();
newList.addAll(this);
newList.add(s);
return newList;
}
/**
* Convert this list to a string array.
*
* @return the string array
*/
public String[] toArray() {
String[] list = new String[size()];
for (int i = 0; i < size(); i++) {
list[i] = (String) get(i);
}
return list;
}
}
/**
* A list of files.
*/
public static class FileList extends ArrayList implements List {
private static final long serialVersionUID = -3241001695597802578L;
private static final long serialVersionUID = 1L;
/**
* Remove the files that match from the list.
......@@ -190,7 +247,7 @@ public class BuildBase {
* @param args the command line parameters
* @return the exit value
*/
protected int execScript(String script, String[] args) {
protected int execScript(String script, StringList args) {
if (isWindows()) {
script = script + ".bat";
}
......@@ -204,19 +261,19 @@ public class BuildBase {
* @param args the command line parameters
* @return the exit value
*/
protected int exec(String command, String[] args) {
protected int exec(String command, StringList args) {
try {
print(command);
for (int i = 0; args != null && i < args.length; i++) {
print(" " + args[i]);
for (int i = 0; args != null && i < args.size(); i++) {
print(" " + args.get(i));
}
println("");
String[] cmdArray = new String[1 + (args == null ? 0 : args.length)];
cmdArray[0] = command;
StringList cmd = new StringList();
cmd = cmd.plus(command);
if (args != null) {
System.arraycopy(args, 0, cmdArray, 1, args.length);
cmd.addAll(args);
}
Process p = Runtime.getRuntime().exec(cmdArray);
println("");
Process p = Runtime.getRuntime().exec(cmd.toArray());
copyInThread(p.getInputStream(), quiet ? null : out);
copyInThread(p.getErrorStream(), quiet ? null : out);
p.waitFor();
......@@ -345,7 +402,7 @@ public class BuildBase {
*
* @param args the command line arguments to pass
*/
protected void javadoc(String[] args) {
protected void javadoc(StringList args) {
int result;
PrintStream old = System.out;
try {
......@@ -361,7 +418,8 @@ public class BuildBase {
}
Class clazz = Class.forName("com.sun.tools.javadoc.Main");
Method execute = clazz.getMethod("execute", new Class[] { String[].class });
result = ((Integer) invoke(execute, null, new Object[] { args })).intValue();
String[] array = args.toArray();
result = ((Integer) invoke(execute, null, new Object[] { array })).intValue();
} catch (Exception e) {
result = exec("javadoc", args);
} finally {
......@@ -667,12 +725,12 @@ public class BuildBase {
* @param args the command line parameters
* @param files the file list
*/
protected void javac(String[] args, FileList files) {
protected void javac(StringList args, FileList files) {
println("Compiling " + files.size() + " classes");
ArrayList argList = new ArrayList(Arrays.asList(args));
argList.addAll(getPaths(filterFiles(files, true, ".java")));
args = new String[argList.size()];
argList.toArray(args);
StringList params = new StringList();
params.addAll(args);
params.addAll(getPaths(filterFiles(files, true, ".java")));
String[] array = params.toArray();
int result;
PrintStream old = System.err;
try {
......@@ -684,7 +742,7 @@ public class BuildBase {
Class clazz = Class.forName("com.sun.tools.javac.Main");
Method compile = clazz.getMethod("compile", new Class[] { String[].class });
Object instance = clazz.newInstance();
result = ((Integer) invoke(compile, instance, new Object[] { args })).intValue();
result = ((Integer) invoke(compile, instance, new Object[] { array })).intValue();
} catch (Exception e) {
e.printStackTrace();
result = exec("javac", args);
......@@ -702,14 +760,12 @@ public class BuildBase {
* @param className the class name
* @param args the command line parameters to pass
*/
protected void java(String className, String[] args) {
protected void java(String className, StringList args) {
println("Running " + className);
if (args == null) {
args = new String[0];
}
String[] array = args == null ? new String[0] : args.toArray();
try {
Method main = Class.forName(className).getMethod("main", new Class[] { String[].class });
invoke(main, null, new Object[] { args });
invoke(main, null, new Object[] { array });
} catch (Exception e) {
throw new Error(e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论