-
Notifications
You must be signed in to change notification settings - Fork 199
/
build.gradle.kts
93 lines (81 loc) · 2.73 KB
/
build.gradle.kts
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
buildscript {
repositories {
// Use 'gradle install' to install latest
mavenLocal()
gradlePluginPortal()
}
dependencies {
classpath("com.github.ben-manes:gradle-versions-plugin:+")
}
}
apply(plugin = "com.github.ben-manes.versions")
repositories {
mavenCentral()
}
configurations {
register("bom")
register("upToDate")
register("exceedLatest")
register("platform")
register("upgradesFound")
register("upgradesFound2")
register("unresolvable")
register("unresolvable2")
}
fun String.isNonStable(): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(this)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
// Example 1: reject all non stable versions
rejectVersionIf {
candidate.version.isNonStable()
}
// Example 2: disallow release candidates as upgradable versions from stable versions
rejectVersionIf {
candidate.version.isNonStable() && !currentVersion.isNonStable()
}
// Example 3: using the full syntax
resolutionStrategy {
componentSelection {
all {
if (candidate.version.isNonStable() && !currentVersion.isNonStable()) {
reject("Release candidate")
}
}
}
}
// optional parameters
checkForGradleUpdate = true
outputFormatter = "json"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
}
dependencies {
"bom"("org.springframework.boot:spring-boot-dependencies:1.5.8.RELEASE")
"bom"("com.google.code.gson:gson")
"bom"("dom4j:dom4j")
"upToDate"("backport-util-concurrent:backport-util-concurrent:3.1")
"upToDate"("backport-util-concurrent:backport-util-concurrent-java12:3.1")
"exceedLatest"("com.google.guava:guava:99.0-SNAPSHOT")
"exceedLatest"("com.google.guava:guava-tests:99.0-SNAPSHOT")
"upgradesFound"("com.google.guava:guava:15.0")
"upgradesFound"("com.google.inject:guice:2.0")
"upgradesFound"("com.google.inject.extensions:guice-multibindings:2.0")
"upgradesFound2"("com.google.guava:guava:16.0-rc1")
"unresolvable"("com.github.ben-manes:unresolvable:1.0")
"unresolvable"("com.github.ben-manes:unresolvable2:1.0")
"unresolvable2"("com.github.ben-manes:unresolvable:1.0")
"unresolvable2"("com.github.ben-manes:unresolvable2:1.0")
"platform"("com.linecorp.armeria:armeria")
"platform"("io.zipkin.brave:brave")
// Common usage would be to separate this into a project that uses the `java-platform` plugin to
// share constraints among several projects.
constraints {
"platform"("com.linecorp.armeria:armeria:0.90.0")
"platform"("io.zipkin.brave:brave:5.7.0")
}
}