-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
75 lines (62 loc) · 2.5 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.serialization) apply false
// Versions Plugin
// https://github.com/ben-manes/gradle-versions-plugin
alias(libs.plugins.versions) apply false
// BuildInfo Plugin
// https://codeberg.org/h34tnet/buildinfo
alias(libs.plugins.buildinfo) apply false
}
tasks {
register<Delete>("clean") {
delete(project.layout.buildDirectory)
}
}
subprojects {
//
// Configure DependencyUpdatesTask for all subprojects,
// that checks dependencies for version updates.
//
// see https://github.com/ben-manes/gradle-versions-plugin
//
tasks.withType<DependencyUpdatesTask>().configureEach {
checkForGradleUpdate = false
// Helper method to decide, if a dependency version is considered as stable or unstable.
@Suppress("UNUSED_PARAMETER")
fun isNonStable(version: String, group: String, module: String): Boolean {
// println("CHECK ${group}:${module}:$version")
if (group == "org.jetbrains.kotlin" || group.startsWith("org.jetbrains.kotlin.")) {
// versions like 1.6.20-M1 are considered unstable
if (version.matches("^.*-M\\d*$".toRegex())) {
return true
}
// versions like 1.6.20-RC2 are considered unstable
if (version.matches("^.*-RC\\d*$".toRegex())) {
return true
}
}
val suffixes = mutableListOf("alpha", "eap")
val betaAllowedForGroup = group.startsWith("org.jetbrains.compose")
if (!betaAllowedForGroup) {
suffixes.add("beta")
}
val rcAllowedForGroup = group.startsWith("org.jetbrains.compose")
if (!rcAllowedForGroup) {
suffixes.add("rc")
}
return suffixes.any {
version.contains(it, true)
}
}
rejectVersionIf {
isNonStable(this.candidate.version, this.candidate.group, this.candidate.module)
&& !isNonStable(this.currentVersion, this.candidate.group, this.candidate.module)
}
}
}