forked from igorwojda/android-showcase
/
build.gradle.kts
66 lines (55 loc) 路 1.86 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
import io.gitlab.arturbosch.detekt.Detekt
@Suppress("DSL_SCOPE_VIOLATION") // Because of IDE bug https://youtrack.jetbrains.com/issue/KTIJ-19370
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.safeArgs) apply false
alias(libs.plugins.junit5Android) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.detekt)
}
subprojects {
tasks.withType<Test> {
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
}
}
spotless {
kotlin {
target("**/*.kt", "**/*.kts")
ktlint()
indentWithSpaces()
endWithNewline()
}
}
val detektCheck by tasks.registering(Detekt::class) {
description = "Checks that sourcecode satisfies detekt rules."
autoCorrect = false
}
val detektApply by tasks.registering(Detekt::class) {
description = "Applies code formatting rules to sourcecode in-place."
autoCorrect = true
}
configure(listOf(detektCheck, detektApply)) {
configure {
group = "verification"
parallel = true
ignoreFailures = false
setSource(file(projectDir))
// Custom detekt config
config.setFrom("$projectDir/detekt.yml")
// Use default configuration on top of custom config
// (new detect rules will work out of the box after upgrading detekt version)
buildUponDefaultConfig = true
/*
Runs detekt for all files in the Gradle project and all subprojects without
a need to configure detekt plugin in every subproject.
*/
include("**/*.kt", "**/*.kts")
exclude("**/resources/**", "**/build/**", "**/generated/**")
reports {
html.required.set(true)
xml.required.set(true)
}
}
}