Polish support for topic branch-specific versions

Issue: SPR-10124
This commit is contained in:
Chris Beams 2013-01-03 14:06:02 +01:00
parent 426b099965
commit 44a7e77e6d
1 changed files with 47 additions and 13 deletions

View File

@ -9,6 +9,9 @@ buildscript {
}
configure(allprojects) {
group = "org.springframework"
version = qualifyVersionIfNecessary(version)
ext.aspectjVersion = "1.7.1"
ext.easymockVersion = "2.5.2"
ext.hsqldbVersion = "1.8.0.10"
@ -16,26 +19,41 @@ configure(allprojects) {
ext.slf4jVersion = "1.6.1"
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
if (rootProject.hasProperty("VERSION_QUALIFIER")) {
def qualifier = rootProject.getProperty("VERSION_QUALIFIER")
if (qualifier.startsWith("SPR-")) { // topic branch, e.g. SPR-1234
// replace 3.2.0.BUILD-SNAPSHOT for 3.2.0.SPR-1234-SNAPSHOT
version = version.replace('BUILD', qualifier)
}
}
apply plugin: "propdeps"
apply plugin: "java"
apply plugin: "propdeps-eclipse"
apply plugin: "propdeps-idea"
apply from: "${gradleScriptDir}/ide.gradle"
group = "org.springframework"
compileJava {
sourceCompatibility=1.5
targetCompatibility=1.5
}
compileTestJava {
sourceCompatibility=1.7
targetCompatibility=1.7
}
sourceCompatibility=1.5
targetCompatibility=1.5
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none"]
[compileJava, compileTestJava]*.options*.compilerArgs = [
"-Xlint:serial",
"-Xlint:varargs",
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:-rawtypes", // TODO enable and fix warnings
"-Xlint:-deprecation", // TODO enable and fix warnings
"-Xlint:-unchecked" // TODO enable and fix warnings
]
sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]
@ -898,3 +916,19 @@ configure(rootProject) {
}
}
}
/*
* Support publication of artifacts versioned by topic branch.
* CI builds supply `-P BRANCH_NAME=<TOPIC>` to gradle at build time.
* If <TOPIC> starts with 'SPR-', change version
* from BUILD-SNAPSHOT => <TOPIC>-SNAPSHOT
* e.g. 3.2.1.BUILD-SNAPSHOT => 3.2.1.SPR-1234-SNAPSHOT
*/
def qualifyVersionIfNecessary(version) {
if (rootProject.hasProperty("BRANCH_NAME")) {
def qualifier = rootProject.getProperty("BRANCH_NAME")
if (qualifier.startsWith("SPR-")) {
version = version.replace('BUILD', qualifier)
}
}
}