LUCENE-4180: Bump Constants.LUCENE_MAIN_VERSION before beta release

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1361857 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-07-16 01:38:10 +00:00
parent decfcdbbbb
commit dc27d24e0b
2 changed files with 20 additions and 5 deletions

View File

@ -117,9 +117,14 @@ public final class Constants {
Package pkg = LucenePackage.get(); Package pkg = LucenePackage.get();
String v = (pkg == null) ? null : pkg.getImplementationVersion(); String v = (pkg == null) ? null : pkg.getImplementationVersion();
if (v == null) { if (v == null) {
String parts[] = LUCENE_MAIN_VERSION.split("\\.");
if (parts.length == 4) {
// alpha/beta
assert parts[2].equals("0");
v = parts[0] + "." + parts[1] + "-SNAPSHOT";
} else {
v = LUCENE_MAIN_VERSION + "-SNAPSHOT"; v = LUCENE_MAIN_VERSION + "-SNAPSHOT";
} else if (!v.startsWith(LUCENE_MAIN_VERSION)) { }
v = LUCENE_MAIN_VERSION + "-SNAPSHOT " + v;
} }
LUCENE_VERSION = ident(v); LUCENE_VERSION = ident(v);
} }

View File

@ -119,9 +119,19 @@ public class TestCheckIndex extends LuceneTestCase {
// common-build.xml sets lucene.version // common-build.xml sets lucene.version
final String version = System.getProperty("lucene.version"); final String version = System.getProperty("lucene.version");
assertNotNull( "null version", version); assertNotNull( "null version", version);
final String constantVersion;
String parts[] = Constants.LUCENE_MAIN_VERSION.split("\\.");
if (parts.length == 4) {
// alpha/beta version: pull the real portion
assert parts[2].equals("0");
constantVersion = parts[0] + "." + parts[1];
} else {
// normal version
constantVersion = Constants.LUCENE_MAIN_VERSION;
}
assertTrue("Invalid version: "+version, assertTrue("Invalid version: "+version,
version.equals(Constants.LUCENE_MAIN_VERSION+"-SNAPSHOT") || version.equals(constantVersion+"-SNAPSHOT") ||
version.equals(Constants.LUCENE_MAIN_VERSION)); version.equals(constantVersion));
assertTrue(Constants.LUCENE_VERSION + " should start with: "+version, assertTrue(Constants.LUCENE_VERSION + " should start with: "+version,
Constants.LUCENE_VERSION.startsWith(version)); Constants.LUCENE_VERSION.startsWith(version));
} }