-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
77 lines (68 loc) · 2.11 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
76
77
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import java.util.Locale
buildscript {
Repo.addRepos(repositories)
dependencies {
classpath(libs.gradle)
classpath(libs.google.services)
classpath(libs.kotlin.gradle.plugin)
classpath(libs.kotlin.serialization)
classpath(libs.gradle.versions.plugin)
classpath(libs.sqldelight.gradle.plugin)
classpath(libs.paparazzi.gradle.plugin)
}
}
plugins {
alias(libs.plugins.compose.compiler) apply false
}
allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
afterEvaluate {
project.extensions.findByType<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension>()
.let { kmpExt ->
kmpExt?.sourceSets?.removeAll {
setOf(
"androidAndroidTestRelease",
"androidTestFixtures",
"androidTestFixturesDebug",
"androidTestFixturesRelease",
).contains(it.name)
}
}
}
}
/**
* Run with `./gradlew dependencyUpdates` and the report will be in:
* /build/dependencyUpdates/versionsReport.html
*/
apply(plugin = "com.github.ben-manes.versions")
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase(Locale.getDefault())
.contains(it)
}
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Release candidate")
}
}
}
}
checkForGradleUpdate = true
outputFormatter = "html"
reportfileName = "versionsReport"
}
tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}