提交 a5051304 authored 作者: Thomas Mueller's avatar Thomas Mueller

Build: support target version

上级 59ec5233
...@@ -98,11 +98,15 @@ public class Build extends BuildBase { ...@@ -98,11 +98,15 @@ public class Build extends BuildBase {
} }
private void compileTools() { private void compileTools() {
mkdir("temp");
FileList files = files("src/tools").keep("src/tools/org/h2/build/*"); FileList files = files("src/tools").keep("src/tools/org/h2/build/*");
StringList args = args("-d", "temp", "-sourcepath", "src/tools" + StringList args = args("-d", "temp", "-sourcepath", "src/tools" +
File.pathSeparator + "src/test" + File.pathSeparator + "src/test" +
File.pathSeparator + "src/main"); File.pathSeparator + "src/main");
mkdir("temp"); String version = getTargetJavaVersion();
if (version != null) {
args = args.plus("-target", version);
}
javac(args, files); javac(args, files);
} }
...@@ -147,9 +151,13 @@ public class Build extends BuildBase { ...@@ -147,9 +151,13 @@ public class Build extends BuildBase {
switchSource(true); switchSource(true);
} }
private static String getTargetJavaVersion() {
return System.getProperty("version");
}
private static void switchSource(boolean enableCheck) { private static void switchSource(boolean enableCheck) {
try { try {
String version = System.getProperty("version"); String version = getTargetJavaVersion();
String check = enableCheck ? "+CHECK" : "-CHECK"; String check = enableCheck ? "+CHECK" : "-CHECK";
if (version == null) { if (version == null) {
SwitchSource.main("-dir", "src", "-auto", check); SwitchSource.main("-dir", "src", "-auto", check);
...@@ -177,6 +185,10 @@ public class Build extends BuildBase { ...@@ -177,6 +185,10 @@ public class Build extends BuildBase {
args = args.plus("-Xlint:unchecked", "-g:none", "-d", "temp", args = args.plus("-Xlint:unchecked", "-g:none", "-d", "temp",
"-sourcepath", "src/main", "-classpath", classpath); "-sourcepath", "src/main", "-classpath", classpath);
} }
String version = getTargetJavaVersion();
if (version != null) {
args = args.plus("-target", version);
}
javac(args, files); javac(args, files);
} }
...@@ -203,12 +215,6 @@ public class Build extends BuildBase { ...@@ -203,12 +215,6 @@ public class Build extends BuildBase {
files = files("src/main"); files = files("src/main");
} }
StringList args = args(); StringList args = args();
if (System.getProperty("version") != null) {
String bcp = System.getProperty("bcp");
// /System/Library/Frameworks/JavaVM.framework/
// Versions/1.4/Classes/classes.jar
args = args.plus("-source", "1.5", "-target", "jsr14", "-bootclasspath", bcp);
}
if (debugInfo) { if (debugInfo) {
args = args.plus("-Xlint:unchecked", args = args.plus("-Xlint:unchecked",
"-d", "temp", "-sourcepath", "src/main", "-classpath", classpath); "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath);
...@@ -216,6 +222,10 @@ public class Build extends BuildBase { ...@@ -216,6 +222,10 @@ public class Build extends BuildBase {
args = args.plus("-Xlint:unchecked", "-g:none", args = args.plus("-Xlint:unchecked", "-g:none",
"-d", "temp", "-sourcepath", "src/main", "-classpath", classpath); "-d", "temp", "-sourcepath", "src/main", "-classpath", classpath);
} }
String version = getTargetJavaVersion();
if (version != null) {
args = args.plus("-target", version);
}
javac(args, files); javac(args, files);
files = files("src/main/META-INF/services"); files = files("src/main/META-INF/services");
...@@ -227,6 +237,9 @@ public class Build extends BuildBase { ...@@ -227,6 +237,9 @@ public class Build extends BuildBase {
args = args("-Xlint:unchecked", "-Xlint:deprecation", args = args("-Xlint:unchecked", "-Xlint:deprecation",
"-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools", "-d", "temp", "-sourcepath", "src/test" + File.pathSeparator + "src/tools",
"-classpath", classpath); "-classpath", classpath);
if (version != null) {
args = args.plus("-target", version);
}
javac(args, files); javac(args, files);
files = files("src/test"). files = files("src/test").
exclude("*.java"). exclude("*.java").
...@@ -945,10 +958,14 @@ public class Build extends BuildBase { ...@@ -945,10 +958,14 @@ public class Build extends BuildBase {
throw new RuntimeException("h2.ftpPassword not set"); throw new RuntimeException("h2.ftpPassword not set");
} }
downloadTest(); downloadTest();
mkdir("temp");
FileList files = files("src/tools").keep("*/UploadBuild.java"); FileList files = files("src/tools").keep("*/UploadBuild.java");
StringList args = args("-d", "temp", "-sourcepath", "src/tools" + StringList args = args("-d", "temp", "-sourcepath", "src/tools" +
File.pathSeparator + "src/test" + File.pathSeparator + "src/main"); File.pathSeparator + "src/test" + File.pathSeparator + "src/main");
mkdir("temp"); String version = getTargetJavaVersion();
if (version != null) {
args = args.plus("-target", version);
}
javac(args, files); javac(args, files);
String cp = "bin" + File.pathSeparator + "temp" + String cp = "bin" + File.pathSeparator + "temp" +
File.pathSeparator + "ext/h2mig_pagestore_addon.jar"; File.pathSeparator + "ext/h2mig_pagestore_addon.jar";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论