-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
92 lines (83 loc) · 2.85 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
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektPlugin
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath (libs.android.tools.build.gradle)
classpath (libs.kotlin.gradle.plugin)
classpath (libs.gms.oss.licenses.plugin)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
alias(libs.plugins.detekt)
alias(libs.plugins.dagger.hilt.android.core) apply false
}
// see https://detekt.dev/docs/introduction/reporting/#merging-reports
val reportMerge by tasks.registering(ReportMergeTask::class) {
output.set(rootProject.layout.buildDirectory.file("reports/detekt/merge.xml")) // or "reports/detekt/merge.sarif"
}
subprojects {
apply(plugin = "io.gitlab.arturbosch.detekt")
dependencies {
detektPlugins(rootProject.project.libs.detekt.formatting)
}
detekt {
// デフォルトの設定を引き継ぐ
buildUponDefaultConfig = true
// 並列してファイルを見る
parallel = true
// Detekt 設定ファイルの指定
config = files("${project.rootDir}/config/detekt/detekt.yml")
// Detekt ベースラインファイルの指定
baseline = file("${project.rootDir}/config/detekt/baseline.yml")
// ルールに沿わないソースがあったら detekt タスクを失敗させる
ignoreFailures = false
// ルールに沿わない記述箇所には自動修正をかける
autoCorrect = true
}
plugins.withType<DetektPlugin> {
tasks.withType<Detekt> detekt@{
finalizedBy(reportMerge)
reports.xml.required.set(true)
reportMerge.configure {
input.from([email protected])
}
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task<Delete>("clean") {
delete(rootProject.buildDir)
}
tasks.withType<Detekt>().configureEach {
jvmTarget = "17"
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = "17"
}
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
description = "Overrides current baseline."
ignoreFailures.set(true)
parallel.set(true)
buildUponDefaultConfig.set(true)
setSource(files(rootDir))
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
baseline.set(file("$rootDir/config/detekt/baseline.xml"))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
}