-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
52 lines (47 loc) · 1.69 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
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://youtrack.jetbrains.com/issue/KTIJ-19369.
@Suppress(
"DSL_SCOPE_VIOLATION",
"MISSING_DEPENDENCY_CLASS",
"UNRESOLVED_REFERENCE_WRONG_RECEIVER",
"FUNCTION_CALL_EXPECTED"
)
plugins {
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)
}
allprojects {
group = "com.ianbrandt"
version = "1.0-SNAPSHOT"
}
tasks {
withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf {
isNonStable(candidate.version)
}
gradleReleaseChannel = CURRENT.id
}
named<Wrapper>("wrapper").configure {
gradleVersion = "8.0.2"
distributionType = ALL
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase().contains(it)
}
val unstableKeyword =
version.uppercase().contains("""M\d+""".toRegex())
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = (stableKeyword && !unstableKeyword) || regex.matches(version)
return isStable.not()
}