-
Notifications
You must be signed in to change notification settings - Fork 2
/
add-versions-plugin.gradle
29 lines (24 loc) · 1020 Bytes
/
add-versions-plugin.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* This file adds the 'Versions' plugin to our project so we can lookup the latest
* versions of our dependencies using the :dependencyUpdates.
*/
// Required syntax for applying a plugin from a outside of the build.gradle file
buildscript {
repositories.jcenter()
dependencies.classpath "com.github.ben-manes:gradle-versions-plugin:0.21.0"
}
apply plugin: com.github.benmanes.gradle.versions.VersionsPlugin
// Configure the :dependencyUpdates task to only output release versions
def suffixesOfVersionsToOmit = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea']
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean isNonReleaseVersion = suffixesOfVersionsToOmit.any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d-+]*.*/
}
if (isNonReleaseVersion) {
selection.reject('Release candidate')
}
}
}
}