From 44a7e77e6dfc18cb83b1abf52c892b52484fdfe0 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 3 Jan 2013 14:06:02 +0100 Subject: [PATCH] Polish support for topic branch-specific versions Issue: SPR-10124 --- build.gradle | 60 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index a0882a2fe0a..1f1d23e2c62 100644 --- a/build.gradle +++ b/build.gradle @@ -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=` to gradle at build time. + * If starts with 'SPR-', change version + * from BUILD-SNAPSHOT => -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) + } + } +}