-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
50 lines (44 loc) · 1.34 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import com.github.benmanes.gradle.versions.updates.gradle.GradleReleaseChannel.CURRENT
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
// Without these suppressions version catalog usage here and in other build
// files is marked red by IntelliJ:
// https://github.com/gradle/gradle/issues/22797.
@Suppress(
"DSL_SCOPE_VIOLATION",
"MISSING_DEPENDENCY_CLASS",
"UNRESOLVED_REFERENCE_WRONG_RECEIVER",
"FUNCTION_CALL_EXPECTED"
)
plugins {
alias(libs.plugins.versions.gradle.plugin)
}
allprojects {
group = "com.ianbrandt"
version = "1.0-SNAPSHOT"
}
tasks {
named<DependencyUpdatesTask>("dependencyUpdates").configure {
checkConstraints = true
checkBuildEnvironmentConstraints = true
rejectVersionIf {
isNonStable(candidate.version)
}
gradleReleaseChannel = CURRENT.id
}
named<Wrapper>("wrapper").configure {
gradleVersion = "7.6"
distributionType = ALL
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.toUpperCase()
.contains(it)
}
val unstableKeyword =
listOf("""M\d+""").any { version.toUpperCase().contains(it.toRegex()) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = (stableKeyword && !unstableKeyword) || regex.matches(version)
return isStable.not()
}