-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
51 lines (44 loc) · 1.56 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
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}")
classpath("com.github.ben-manes:gradle-versions-plugin:0.42.0")
classpath("com.autonomousapps:dependency-analysis-gradle-plugin:1.2.1")
}
}
allprojects {
repositories {
google()
mavenCentral()
}
apply {
plugin("com.github.ben-manes.versions")
plugin("com.autonomousapps.dependency-analysis")
}
tasks.named<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask>("dependencyUpdates")
.configure {
gradleReleaseChannel = "current"
}
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val nonStableKeyword =
listOf("AlPHA", "BETA", "PREVIEW", "M", "RC").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = (stableKeyword || regex.matches(version)) && !nonStableKeyword
return isStable.not()
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}