-
Notifications
You must be signed in to change notification settings - Fork 120
/
build.gradle.kts
104 lines (91 loc) · 4.09 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
99
100
101
102
103
104
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.BasePlugin
import com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id(androidx.plugins.application.get().pluginId) apply false
id(androidx.plugins.library.get().pluginId) apply false
alias(libs.plugins.google.services) apply false
id(kotlinx.plugins.android.get().pluginId) apply false
alias(kotlinx.plugins.compose.compiler) apply false
id(kotlinx.plugins.jvm.get().pluginId) apply false
id(kotlinx.plugins.parcelize.get().pluginId) apply false
alias(libs.plugins.about.libraries) apply false
alias(kotlinx.plugins.serialization) apply false
alias(libs.plugins.firebase) apply false
alias(libs.plugins.ktfmt)
}
subprojects {
tasks {
withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.addAll(
listOf(
"-Xcontext-receivers",
"-opt-in=kotlin.Experimental",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi",
"-opt-in=androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi",
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
"-opt-in=kotlin.time.ExperimentalTime",
"-opt-in=kotlinx.coroutines.DelicateCoroutinesApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=coil.annotation.ExperimentalCoilApi",
"-opt-in=kotlin.ExperimentalStdlibApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
)
}
this.dependsOn("ktfmtFormat")
}
withType<Test>() {
useJUnitPlatform()
testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) }
}
}
plugins.withType<BasePlugin> {
plugins.apply(libs.plugins.ktfmt.get().pluginId)
ktfmt {
kotlinLangStyle()
removeUnusedImports = true
}
configure<BaseExtension> {
compileSdkVersion(AndroidConfig.compileSdkVersion)
defaultConfig {
minSdk = AndroidConfig.minSdkVersion
targetSdk = AndroidConfig.targetSdkVersion
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
dependencies { add("coreLibraryDesugaring", libs.desugaring) }
packagingOptions {
resources.excludes.add("META-INF/LICENSE-LGPL-2.1.txt")
resources.excludes.add("META-INF/LICENSE-LGPL-3.txt")
resources.excludes.add("META-INF/LICENSE-W3C-TEST")
resources.excludes.add("META-INF/DEPENDENCIES")
}
}
}
}
tasks.register("clean", Delete::class) { delete(rootProject.layout.buildDirectory) }
tasks.register<Copy>("installGitHook") {
from("pre-commit")
into(layout.projectDirectory.dir(".git/hooks"))
fileMode = 777
}
afterEvaluate {
// We install the hook at the first occasion
tasks["clean"].dependsOn(tasks.getByName("installGitHook"))
}
tasks.register<KtfmtFormatTask>("ktfmtPrecommit")