2012-12-13 11:04:52 -05:00
task checkDependencies < < {
2015-03-23 12:14:26 -04:00
verifyNoDependenciesMatchingVersion ( ".*-SNAPSHOT" )
if ( releaseBuild ) {
verifyNoDependenciesMatchingVersion ( ".*M.*" )
verifyNoDependenciesMatchingVersion ( ".*RC.*" )
}
2012-12-13 11:04:52 -05:00
}
if ( ! snapshotBuild ) {
2015-03-23 12:14:26 -04:00
tasks . findByPath ( 'check' ) ? . dependsOn checkDependencies
2012-12-13 11:04:52 -05:00
}
def verifyNoDependenciesMatchingVersion ( def pattern ) {
2015-03-23 12:14:26 -04:00
def dependencies = configurations . all * . allDependencies * . findAll { d - >
def ignored = 'io.spring.platform:platform-versions'
def groupAndName = "$d.group:$d.name" . toString ( )
ignored ! = groupAndName & & 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" )
}
2012-12-13 11:04:52 -05:00
}