[generator] Better version matching for the milestone (stable) builds

Signed-off-by: Dennis Huebner <dennis.huebner@itemis.de>
This commit is contained in:
Dennis Huebner 2015-11-10 16:20:14 +01:00
parent f178c7c2fe
commit b9665965d1
3 changed files with 54 additions and 3 deletions

View file

@ -48,8 +48,8 @@ class XtextVersion {
version.endsWith("-SNAPSHOT")
}
def isBeta() {
version.matches(".*beta(\\d)*")
def isStable() {
return !isSnapshot && !version.matches("\\d+\\.\\d+(\\.\\d+)+")
}
def getXtendGradlePluginVersion() {

View file

@ -71,7 +71,7 @@ class TargetPlatformProject extends ProjectDescriptor {
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
«IF config.xtextVersion.isSnapshot»
<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/nightly/"/>
«ELSEIF config.xtextVersion.isBeta»
«ELSEIF config.xtextVersion.isStable»
<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/milestones/"/>
«ELSE»
<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/releases/«config.xtextVersion»/"/>

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.util;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* @author dhuebner - Initial contribution and API
*/
public class XtextVersionTests {
@Test
public void testVersionKinds() {
XtextVersion version = new XtextVersion("2.9.0-SNAPSHOT");
//snapshot
assertTrue(version.isSnapshot());
assertFalse(version.isStable());
// stable version pre-release
version = new XtextVersion("2.9.0.beta1");
assertFalse(version.isSnapshot());
assertTrue(version.isStable());
version = new XtextVersion("2.9.0.rc1");
assertFalse(version.isSnapshot());
assertTrue(version.isStable());
version = new XtextVersion("2.9.0.maybeSomthingElse");
assertFalse(version.isSnapshot());
assertTrue(version.isStable());
// releases
version = new XtextVersion("2.9.0");
assertFalse(version.isSnapshot());
assertFalse(version.isStable());
version = new XtextVersion("2.9.0.1");
assertFalse(version.isSnapshot());
assertFalse(version.isStable());
}
}