-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
86 lines (76 loc) · 2.7 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.Detekt
plugins {
id(Plugins.BenManes.plugin) version Plugins.BenManes.version
id(Plugins.Spotless.plugin) version (Plugins.Spotless.version)
id(Plugins.Detekts.detekt) version Plugins.Detekts.version
}
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath(ClassPaths.gradlePlugin)
classpath(ClassPaths.kotlinGradlePlugin)
classpath(ClassPaths.hiltGradlePlugin)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle.kts files
}
}
/* ./gradlew dependencyUpdates */
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(candidate.version)
}
checkForGradleUpdate = true
outputDir = "${rootProject.buildDir}/dependencyUpdates"
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
targetExclude("bin/**/*.kt")
ktlint("0.40.0").userData(mapOf("disabled_rules" to "no-wildcard-imports"))
}
}
/*./gradlew check*/
val detektAll by tasks.registering(Detekt::class) {
description = "Runs over whole code base without the starting overhead for each module."
parallel = true
buildUponDefaultConfig = true
setSource(files(projectDir))
config.from(files(project.rootDir.resolve("config/detekt-config.yml")))
include("**/*.kt", "**/*.kts")
exclude("**/resources/**", "**/build/**")
baseline.set(project.rootDir.resolve("config/detekt-baseline.xml"))
reports {
xml.enabled = false
html {
enabled = true
destination = file("${rootProject.buildDir}/reports/detekt-report.html")
}
txt {
enabled = true
destination = file("${rootProject.buildDir}/reports/detekt-report.txt")
}
}
}
// Kotlin DSL
tasks.withType<Detekt>().configureEach {
// Target version of the generated JVM bytecode. It is used for type resolution.
jvmTarget = "1.8"
}
tasks.named("clean", Delete::class.java) {
delete(rootProject.buildDir)
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.17.1")
}