-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
61 lines (56 loc) · 1.82 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
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
plugins {
id("base")
alias(libs.plugins.dependency.analysis.gradle.plugin)
// Kotlin plugin declaration needed here for the Dependency Analysis Plugin,
// but with `apply false` since the root project itself isn't a Kotlin
// project:
// https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/FAQ#typenotpresentexception-type-orgjetbrainskotlingradledslkotlinprojectextension-in-kotlin-jvm-library
alias(libs.plugins.kotlin.gradle.plugin) apply false
alias(libs.plugins.versions.gradle.plugin)
}
dependencyAnalysis {
issues {
all {
onAny {
severity("fail")
}
onUnusedDependencies {
exclude(
// Test dependencies added globally for convenience.
"org.assertj:assertj-core",
"org.junit.jupiter:junit-jupiter",
"org.junit.jupiter:junit-jupiter-api",
"org.junit.jupiter:junit-jupiter-params",
)
}
onIncorrectConfiguration {
// https://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/1059
severity("fail")
exclude("org.jetbrains.kotlin:kotlin-stdlib")
}
}
}
}
tasks {
withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
gradleReleaseChannel = CURRENT.id
}
named<Wrapper>("wrapper").configure {
gradleVersion = "8.11.1"
distributionType = ALL
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase().contains(it)
}
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}