2012-12-13 11:04:52 -05:00
task checkDependencies < < {
verifyNoDependenciesMatchingVersion ( ".*-SNAPSHOT" )
if ( releaseBuild ) {
verifyNoDependenciesMatchingVersion ( ".*M.*" )
verifyNoDependenciesMatchingVersion ( ".*RC.*" )
}
}
if ( ! snapshotBuild ) {
2013-11-01 10:32:24 -04:00
tasks . findByPath ( 'check' ) ? . dependsOn checkDependencies
2012-12-13 11:04:52 -05:00
}
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" )
}
}