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

Source code switching using //## has been simplified.

上级 260fab0d
......@@ -444,9 +444,9 @@ public class TestMetaData extends TestBase {
assertEquals(meta.getDatabaseMajorVersion(), meta.getDriverMajorVersion());
assertEquals(meta.getDatabaseMinorVersion(), meta.getDriverMinorVersion());
int majorVersion = 3;
//## Java 1.6 begin ##
//## Java 1.6 ##
majorVersion = 4;
//## Java 1.6 end ##
//*/
assertEquals(majorVersion, meta.getJDBCMajorVersion());
assertEquals(0, meta.getJDBCMinorVersion());
}
......
......@@ -137,11 +137,9 @@ public class TestStatement extends TestBase {
Statement stat = conn.createStatement();
//## Java 1.4 begin ##
assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, conn.getHoldability());
conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, conn.getHoldability());
//## Java 1.4 end ##
// ignored
stat.setCursorName("x");
......
......@@ -133,11 +133,10 @@ public class Build extends BuildBase {
try {
String version = System.getProperty("version");
String check = enableCheck ? "+CHECK" : "-CHECK";
String noCheck = enableCheck ? "-NO_CHECK" : "+NO_CHECK";
if (version == null) {
SwitchSource.main("-dir", "src", "-auto", check, noCheck);
SwitchSource.main("-dir", "src", "-auto", check);
} else {
SwitchSource.main("-dir", "src", "-version", version, check, noCheck);
SwitchSource.main("-dir", "src", "-version", version, check);
}
SwitchSource.main("-dir", "src", "-LUCENE2", "-LUCENE3", "+LUCENE" + getLuceneVersion());
} catch (IOException e) {
......
......@@ -59,15 +59,12 @@ public class SwitchSource {
if (version == null) {
// ok
} else if ("1.5".equals(version)) {
enable.add("Java 1.5");
disable.add("Java 1.6");
disable.add("Java 1.7");
} else if ("1.6".equals(version)) {
enable.add("Java 1.5");
enable.add("Java 1.6");
disable.add("Java 1.7");
} else if (version.compareTo("1.7") >= 0) {
enable.add("Java 1.5");
enable.add("Java 1.6");
enable.add("Java 1.7");
} else {
......@@ -129,14 +126,11 @@ public class SwitchSource {
}
String source = new String(buffer);
String target = source;
target = replaceAll(target, "//##", "//##");
for (String x : enable) {
target = replaceAll(target, "/*## " + x + " begin ##", "//## " + x + " begin ##");
target = replaceAll(target, "## " + x + " end ##*/", "//## " + x + " end ##");
target = replaceAll(target, "/*## " + x + " ##", "//## " + x + " ##");
}
for (String x : disable) {
target = replaceAll(target, "//## " + x + " begin ##", "/*## " + x + " begin ##");
target = replaceAll(target, "//## " + x + " end ##", "## " + x + " end ##*/");
target = replaceAll(target, "//## " + x + " ##", "/*## " + x + " ##");
}
if (!source.equals(target)) {
String name = f.getPath();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论