forked from PaulWoitaschek/Voice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
executable file
·98 lines (88 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@file:Suppress("UnstableApiUsage")
buildscript {
dependencies {
classpath(libs.androidPluginForGradle)
classpath(libs.kotlin.pluginForGradle)
}
}
plugins {
alias(libs.plugins.gradleVersions)
alias(libs.plugins.ktlint)
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "7.3.3"
}
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xinline-classes",
"-progressive",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.time.ExperimentalTime",
"-Xopt-in=kotlinx.coroutines.FlowPreview",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=androidx.compose.material.ExperimentalMaterialApi",
"-Xopt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
)
}
}
}
subprojects {
fun addCoreDependencies() {
if (path != ":core") {
dependencies.add("implementation", projects.core)
}
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
plugins.withId("kotlin") {
addCoreDependencies()
}
plugins.withId("kotlin-android") {
addCoreDependencies()
}
}
tasks {
register<Exec>("importStrings") {
executable = "sh"
args("-c", "tx pull -af --minimum-perc=5")
finalizedBy(":core:lintDebug")
}
register<TestReport>("allUnitTests") {
val tests = subprojects.mapNotNull { subProject ->
val tasks = subProject.tasks
(
tasks.findByName("testReleaseUnitTest")
?: tasks.findByName("testDebugUnitTest")
?: tasks.findByName("test")
) as? Test
}
val artifactFolder = File("${rootDir.absolutePath}/artifacts")
destinationDir = File(artifactFolder, "testResults")
reportOn(tests)
}
}
enum class DependencyStability(private val regex: Regex) {
Dev(".*dev.*".toRegex()),
Eap("eap".toRegex()),
Milestone("M1".toRegex()),
Alpha("alpha".toRegex()),
Beta("beta".toRegex()),
Rc("rc".toRegex()),
Stable(".*".toRegex());
companion object {
fun ofVersion(version: String): DependencyStability {
return values().first {
it.regex.containsMatchIn(version)
}
}
}
}
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
rejectVersionIf {
DependencyStability.ofVersion(candidate.version) < DependencyStability.ofVersion(currentVersion)
}
}