-
-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
57 lines (52 loc) · 1.85 KB
/
build.gradle.kts
File metadata and controls
57 lines (52 loc) · 1.85 KB
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
import java.io.File
plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.compose.multiplatform) apply false
alias(libs.plugins.paparazzi) apply false
}
group = "com.inspiredandroid"
// Discover swiftformat in the usual Homebrew locations. Skip Swift formatting
// silently on machines that don't have it (e.g. Linux CI doing Android-only builds).
val swiftformatPath: String? =
listOf(
"/opt/homebrew/bin/swiftformat",
"/usr/local/bin/swiftformat",
).firstOrNull { File(it).exists() }
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint()
.editorConfigOverride(
mapOf(
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_package-name" to "disabled",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_discouraged-comment-location" to "disabled",
),
)
}
kotlinGradle {
target("**/*.gradle.kts")
ktlint()
}
if (swiftformatPath != null) {
format("swift") {
target("iosApp/**/*.swift")
targetExclude("iosApp/**/.build/**", "iosApp/**/Pods/**", "iosApp/**/build/**")
nativeCmd(
"swiftformat",
swiftformatPath,
emptyList(),
)
}
} else {
logger.lifecycle(
"Spotless: swiftformat not found in /opt/homebrew/bin or /usr/local/bin — Swift formatting skipped. " +
"Install with: brew install swiftformat",
)
}
}