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