-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
138 lines (119 loc) · 3.64 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.detekt
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:${Versions.android_gradle}")
classpath(kotlin("gradle-plugin", Versions.kotlin))
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.AndroidX.navigation}")
classpath("org.jetbrains.kotlin:kotlin-android-extensions:${Versions.kotlin}")
classpath("org.jacoco:org.jacoco.core:${Versions.Test.jacoco}")
}
}
plugins {
id("com.gradle.build-scan").version(Versions.buildScan)
id("io.gitlab.arturbosch.detekt").version(Versions.detekt)
id("org.jlleitschuh.gradle.ktlint").version(Versions.ktlintGradle)
id("com.github.ben-manes.versions").version(Versions.benManes)
`git-hooks`
}
allprojects {
repositories {
google()
jcenter()
maven(url = "https://jitpack.io")
}
// configurations.all {
// resolutionStrategy {
// force("org.objenesis:objenesis:2.6")
// }
// }
}
subprojects {
apply { plugin("org.jlleitschuh.gradle.ktlint") }
ktlint {
android.set(true)
reporters.set(setOf(ReporterType.CHECKSTYLE))
ignoreFailures.set(true)
debug.set(false)
verbose.set(false)
outputToConsole.set(false)
filter {
exclude("**/generated/**", "**/*.kts")
include("**/kotlin/**")
}
}
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detekt}")
}
detekt {
toolVersion = Versions.detekt
input = files("$projectDir/app/src/main/java",
"$projectDir/cache/src/main/java",
"$projectDir/core/src/main/java",
"$projectDir/data/src/main/java",
"$projectDir/domain/src/main/java",
"$projectDir/local/src/main/java",
"$projectDir/remote/src/main/java"
)
parallel = true
config = files("$projectDir/default-detekt-config.yml")
isIgnoreFailures = true
reports {
html {
enabled = true
destination = file("reports/detekt.html")
}
xml {
enabled = true
destination = file("$buildDir/reports/detekt.xml")
}
}
}
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
tasks {
register<Delete>("clean") {
description = "Delete the root project build folder"
group = "cleanup"
delete(rootProject.buildDir)
}
register<Detekt>("detektFormat") {
description = "Reformats whole code base."
group = "formatting"
parallel = true
disableDefaultRuleSets = true
buildUponDefaultConfig = true
autoCorrect = true
setSource(files(projectDir))
include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
config = files("$projectDir/default-detekt-config.yml")
reports {
xml { enabled = false }
html { enabled = false }
}
}
register("runChecksForDanger") {
group = "Reporting"
dependsOn(
"${Modules.domain}:lint",
"${Modules.data}:lint",
"${Modules.cache}:lint",
"${Modules.remote}:lint",
"${Modules.core}:lint",
"${Modules.app}:lint"
)
val lintFile = File("${project.rootDir}/build/reports/lint")
if (!lintFile.exists()) lintFile.mkdirs()
}
}