-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle.kts
58 lines (50 loc) · 1.39 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.versions)
alias(libs.plugins.version.catalog.update)
}
buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
subprojects {
apply(plugin = "com.diffplug.spotless")
spotless {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
targetExclude("bin/**/*.kt")
ktlint()
}
}
}
fun isNonStable(version: String) = listOf(
"alpha", "beta", // Firebase, Avast
"-M" // JUnit Jupiter
).any { version.contains(it) }
// Add here dependencies that cannot be updated at the moment
fun cannotUpdate(module: String) = emptyList<String>().any { module.contains(it) }
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
resolutionStrategy {
componentSelection {
all {
if (cannotUpdate(candidate.module)) {
reject("Ignore because we cannot update at the moment.")
}
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Ignore because version is not stable")
}
}
}
}
}