-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdep.gradle
More file actions
53 lines (50 loc) · 1.77 KB
/
dep.gradle
File metadata and controls
53 lines (50 loc) · 1.77 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import groovy.json.JsonOutput
ext {
depUpdateReport = file("$buildDir/dependencies/update-report.json")
}
dependencyUpdates.resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
def contains = { String ptn -> { String ver -> ver.contains(ptn) || ver.contains(ptn.toUpperCase()) } }
def patterns = [
[ptn: 'alpha', pred: contains],
[ptn: 'beta', pred: contains],
[ptn: 'rc', pred: contains],
[ptn: '.+[\\.-]M\\p{Digit}$', pred: { String p -> {
String ver -> ver.matches(p)
} }]
]
def rejected = patterns.any { check ->
def predicate = check.pred(check.ptn)
def version = selection.candidate.version
predicate(version)
}
if (rejected) {
logger.info('{}:{}:{}', selection.candidate.group, selection.candidate.module, selection.candidate.version)
selection.reject('Release candidate')
}
}
}
}
dependencyUpdates {
checkForGradleUpdate = true
outputFormatter = { result ->
def updates = result.outdated.dependencies
if (updates.empty) {
println 'dependencies up to date'
return
}
def list = updates.collect {
[group: it.group,
name: it.name,
current: "${it.version}",
available: it.available.milestone]
}
list.each { println it }
File report = depUpdateReport
if (!report.parentFile.exists()) {
report.parentFile.mkdirs()
}
report.write(JsonOutput.toJson(list), 'UTF-8')
}
}