-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbuild.gradle.kts
39 lines (34 loc) · 1.2 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
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:${Versions.ANDROID_GRADLE_PLUGIN}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}")
classpath("com.google.android.gms:oss-licenses-plugin:${Versions.OSS_LICENSES_PLUGIN}")
classpath("com.github.ben-manes:gradle-versions-plugin:${Versions.GRADLE_VERSIONS_PLUGIN}")
}
}
apply(plugin = "com.github.ben-manes.versions")
fun String.isNonStable(): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(this)
println("$this = $isStable")
return isStable.not()
}
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
candidate.version.isNonStable()
}
// optional parameters
checkForGradleUpdate = true
outputFormatter = "json"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
}
tasks.register("Delete", Delete::class) {
delete(rootProject.buildDir)
}