Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SEC-2096: Added release-checks

  • Loading branch information...
commit 7edb1089a80ea7a29adb6d01c091e6fa55d61b39 1 parent ebb82e1
Rob Winch rwinch authored
Showing with 35 additions and 0 deletions.
  1. +3 −0  build.gradle
  2. +32 −0 gradle/release-checks.gradle
3  build.gradle
View
@@ -11,6 +11,8 @@ allprojects {
repositories {
maven { url "http://repo.springsource.org/libs-snapshot" }
}
+
+
}
// Set up different subproject lists for individual configuration
@@ -26,6 +28,7 @@ configure(subprojects - coreModuleProjects) {
configure(javaProjects) {
apply from: "$rootDir/gradle/javaprojects.gradle"
+ apply from: "$rootDir/gradle/release-checks.gradle"
}
configure(coreModuleProjects) {
32 gradle/release-checks.gradle
View
@@ -0,0 +1,32 @@
+task checkDependencies << {
+ verifyNoDependenciesMatchingVersion(".*-SNAPSHOT")
+ if(releaseBuild) {
+ verifyNoDependenciesMatchingVersion(".*M.*")
+ verifyNoDependenciesMatchingVersion(".*RC.*")
+ }
+}
+
+task checkRepositories << {
+ verifyNoRepositoriesMatching(".*snapshot.*")
+ if(releaseBuild) {
+ verifyNoRepositoriesMatching(".*milestone.*")
+ }
+}
+
+if(!snapshotBuild) {
+ tasks.findByPath('check')?.dependsOn checkRepositories, checkDependencies
+}
+
+def verifyNoDependenciesMatchingVersion(def pattern) {
+ def dependencies = configurations.all*.allDependencies*.findAll { d -> d.version?.matches(pattern) }.flatten().toSet().join("\n ")
+ if(dependencies) {
+ throw new GradleException("${project.name} cannot have dependencies with a version that matches $pattern when its version is ${project.version}. Got\n $dependencies")
+ }
+}
+
+def verifyNoRepositoriesMatching(def pattern) {
+ def matchingRepositories = repositories.findAll { r -> r.url?.toString()?.matches(pattern) }.flatten().collect { it.url }.toSet().join("\n ")
+ if(matchingRepositories) {
+ throw new GradleException("${project.name} cannot have repositories with a version that matches $pattern when its version is ${project.version}. Got\n $matchingRepositories")
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.