-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle.kts
109 lines (92 loc) · 3.47 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
105
106
107
108
109
import com.android.build.api.dsl.CommonExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.gradle.spotless.SpotlessExtensionPredeclare
import com.diffplug.gradle.spotless.SpotlessPlugin
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
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.kotlin.parcelize) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.cache.fix) apply false
alias(libs.plugins.about.libraries) apply false
}
buildscript {
extra["compileSdkVersion"] = 35
extra["targetSdkVersion"] = 35
extra["minSdkVersion"] = 26
}
val javaVersion = JavaVersion.VERSION_17
allprojects {
apply<SpotlessPlugin>()
val configureSpotless: SpotlessExtension.() -> Unit = {
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt")
}
kotlinGradle {
target("**/*.kts")
targetExclude("**/build/**/*.kts")
ktlint()
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
}
format("misc") {
target("*.gradle", "*.md", ".gitignore")
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
if (project === rootProject) {
extensions.getByType<SpotlessExtension>().predeclareDeps()
extensions.configure<SpotlessExtensionPredeclare>(configureSpotless)
} else {
extensions.configure(configureSpotless)
}
}
subprojects {
afterEvaluate {
plugins.withType<com.android.build.gradle.api.AndroidBasePlugin> {
apply(plugin = libs.plugins.cache.fix.get().pluginId)
}
extensions.findByType(CommonExtension::class.java)?.apply {
val compileSdkVersion: Int by project
val minSdkVersion: Int by project
compileSdk = compileSdkVersion
defaultConfig {
minSdk = minSdkVersion
}
compileOptions {
sourceCompatibility(javaVersion)
targetCompatibility(javaVersion)
}
}
extensions.findByType(ComposeCompilerGradlePluginExtension::class.java)?.apply {
stabilityConfigurationFiles.add(rootProject.layout.projectDirectory.file("compose_compiler_config.conf"))
if (project.findProperty("composeCompilerReports") == "true") {
val destinationDir = project.layout.buildDirectory.dir("compose_compiler")
reportsDestination = destinationDir
metricsDestination = destinationDir
}
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
freeCompilerArgs = buildList {
addAll(freeCompilerArgs.get())
add("-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}
}
tasks.findByName("preBuild")?.dependsOn("spotlessCheck")
}
}