added major/minor version properties to version class
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -14,17 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Main gradle build file for Spring Integration
|
||||
//
|
||||
// - run `./gradlew(.bat) build` to kick off a complete compile-test-package
|
||||
//
|
||||
// - the imports above are from groovy and/or java classes in buildSrc/
|
||||
// or from jars on 'buildscript' classpath (in our case, it's all buildSrc)
|
||||
// sources in buildSrc are compiled and placed on the classpath automatically
|
||||
//
|
||||
// @author cbeams
|
||||
// @author Chris Beams
|
||||
// @author Mark Fisher
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -93,6 +89,7 @@ configure(javaprojects) {
|
||||
cglibVersion = '2.2'
|
||||
commonsIoVersion = '1.4'
|
||||
commonsLangVersion = '2.5'
|
||||
commonsNetVersion = '2.0'
|
||||
easymockVersion = '2.3'
|
||||
jacksonVersion = '1.4.3'
|
||||
javaxActivationVersion = '1.1.1'
|
||||
@@ -148,10 +145,11 @@ configure(javaprojects) {
|
||||
project('spring-integration-core') {
|
||||
description = 'Spring Integration Core'
|
||||
dependencies {
|
||||
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
|
||||
compile "org.springframework:spring-aop:$springVersion"
|
||||
compile "org.springframework:spring-context:$springVersion"
|
||||
compile "org.springframework:spring-tx:$springVersion"
|
||||
// 'jackson' should be 'optional' in the generated POM
|
||||
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
|
||||
testCompile "org.aspectj:aspectjrt:$aspectjVersion"
|
||||
testCompile "org.aspectj:aspectjweaver:$aspectjVersion"
|
||||
}
|
||||
@@ -192,12 +190,10 @@ project('spring-integration-ftp') {
|
||||
dependencies {
|
||||
compile "commons-io:commons-io:$commonsIoVersion"
|
||||
compile "commons-lang:commons-lang:$commonsLangVersion"
|
||||
compile "commons-net:commons-net:2.0"
|
||||
compile "commons-net:commons-net:$commonsNetVersion"
|
||||
compile "javax.activation:activation:$javaxActivationVersion"
|
||||
compile "org.springframework:spring-context-support:$springVersion"
|
||||
compile "org.springframework.integration:spring-integration-core:$version"
|
||||
compile "org.springframework.integration:spring-integration-file:$version"
|
||||
compile "org.springframework.integration:spring-integration-stream:$version"
|
||||
testCompile "org.springframework.integration:spring-integration-test:$version"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ class Version {
|
||||
|
||||
String value
|
||||
String releaseType
|
||||
int majorVersion
|
||||
int minorVersion
|
||||
|
||||
/**
|
||||
* @param dotted -quad version spec, e.g.: 1.0.0.RELEASE
|
||||
@@ -15,13 +17,24 @@ class Version {
|
||||
public Version(String value) {
|
||||
this.value = value;
|
||||
this.releaseType = releaseTypeFor(value);
|
||||
this.majorVersion = Integer.parseInt(this.value.substring(0, this.value.indexOf('.')));
|
||||
String afterMajor = this.value.substring(this.value.indexOf('.') + 1);
|
||||
this.minorVersion = Integer.parseInt(afterMajor.substring(0, afterMajor.indexOf('.')));
|
||||
}
|
||||
|
||||
public int getMajorVersion() {
|
||||
return this.majorVersion;
|
||||
}
|
||||
|
||||
public int getMinorVersion() {
|
||||
return this.minorVersion
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 1.0.x style
|
||||
*/
|
||||
public String getWildcardValue() {
|
||||
return "1.0.x";
|
||||
return majorVersion + '.' + minorVersion + '.x';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,9 +51,10 @@ class Version {
|
||||
if (version.endsWith("RELEASE")) return RELEASE;
|
||||
if (version.endsWith("SNAPSHOT")) return SNAPSHOT;
|
||||
if (version.matches(".*\\.M[0-9]+\$")) return MILESTONE;
|
||||
if (version.matches(".*\\.RC[0-9]+\$")) return MILESTONE;
|
||||
|
||||
throw new InvalidUserDataException("unknown version scheme: " +
|
||||
"versions must end in (RELEASE|SNAPSHOT|M[0-9]+), " +
|
||||
"versions must end in (SNAPSHOT|M[0-9]+|RC[0-9]+|RELEASE), " +
|
||||
"but got (" + version + ")");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user