Repository navigation
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
54 lines (51 loc) · 2.4 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
54 lines (51 loc) · 2.4 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
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.roborazzi) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.binary.compatibility.validator)
}
// Formatting is centralised here rather than in a convention plugin: the build
// has two modules, so a buildSrc/build-logic module would cost more than it saves.
// ktlint 1.x defaults to the `ktlint_official` code style, which rewrites every
// multi-line assignment and collapses composable signatures onto one line, and
// its function-naming rule does not know that composables are PascalCase. The
// same values are in `.editorconfig` for the IDE; they are repeated here because
// Spotless resolves ktlint's configuration itself and does not pick that file up.
val ktlintRules = mapOf(
"ktlint_code_style" to "intellij_idea",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable, Preview, Test",
"max_line_length" to "120",
// The `ktlint_official` rules that rewrite working code into a different
// house style. Everything that catches a real defect stays on.
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_class-signature" to "disabled",
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_standard_multiline-expression-wrapping" to "disabled",
"ktlint_standard_string-template-indent" to "disabled",
"ktlint_standard_chain-method-continuation" to "disabled",
"ktlint_standard_blank-line-before-declaration" to "disabled",
"ktlint_standard_blank-line-between-when-conditions" to "disabled",
"ktlint_standard_no-empty-first-line-in-class-body" to "disabled",
"ktlint_standard_if-else-wrapping" to "disabled",
"ktlint_standard_condition-wrapping" to "disabled",
)
spotless {
kotlin {
target("**/*.kt")
targetExclude("**/build/**")
ktlint(libs.versions.ktlint.get()).editorConfigOverride(ktlintRules)
}
kotlinGradle {
target("**/*.gradle.kts")
targetExclude("**/build/**")
ktlint(libs.versions.ktlint.get()).editorConfigOverride(ktlintRules)
}
}
// The catalog application is not published, so its API surface is not tracked.
apiValidation {
ignoredProjects.add("app")
}