-
Notifications
You must be signed in to change notification settings - Fork 68
/
build.gradle.kts
96 lines (85 loc) · 3.55 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.detekt)
alias(libs.plugins.versions)
alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.hilt) apply false
base
}
val ktlintVersion = libs.versions.ktlint.asProvider().get()
val detektFormatting = libs.detekt.formatting
allprojects {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
subprojects {
apply {
plugin("io.gitlab.arturbosch.detekt")
}
detekt {
config = rootProject.files("config/detekt/detekt.yml")
}
dependencies {
detektPlugins(detektFormatting)
}
}
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = false
// Enable experimental coroutines APIs, including Flow
freeCompilerArgs += listOf(
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlin.Experimental",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi",
"-opt-in=com.google.accompanist.pager.ExperimentalPagerApi",
"-opt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
)
if (project.hasProperty("tivi.enableComposeCompilerReports")) {
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
}
// Set JVM target to 11
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
plugins.withId(rootProject.libs.plugins.hilt.get().pluginId) {
extensions.getByType<dagger.hilt.android.plugin.HiltExtension>().enableAggregatingTask = true
}
plugins.withId(rootProject.libs.plugins.kotlin.kapt.get().pluginId) {
extensions.getByType<org.jetbrains.kotlin.gradle.plugin.KaptExtension>().correctErrorTypes = true
}
plugins.withType<com.android.build.gradle.BasePlugin>().configureEach {
extensions.configure<com.android.build.gradle.BaseExtension> {
compileSdkVersion(libs.versions.compile.sdk.version.get().toInt())
defaultConfig {
minSdk = libs.versions.min.sdk.version.get().toInt()
targetSdk = libs.versions.target.sdk.version.get().toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
}
}