-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
100 lines (89 loc) · 2.29 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id(DetektLib.PluginId) version DetektLib.Version
id(GradleVersions.PluginId) version GradleVersions.Version
id(GrGit.PluginId) version GrGit.Version
}
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
jcenter()
}
dependencies {
classpath(Android.GradlePlugin)
classpath(Kotlin.GradlePlugin)
classpath(SqlDelight.Plugin)
classpath(DetektLib.Plugin)
classpath(GradleVersions.Plugin)
classpath(Firebase.CrashlyticsPlugin)
}
}
allprojects {
repositories {
mavenCentral()
google()
maven("https://jitpack.io")
jcenter()
}
tasks.withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.5"
apiVersion = "1.5"
freeCompilerArgs = freeCompilerArgs + listOf(
"-progressive",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xskip-prerelease-check",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xjvm-enable-preview"
)
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
}
dependencies {
detekt(DetektLib.Formatting)
detekt(DetektLib.Cli)
}
tasks.withType<Detekt> {
parallel = true
config.setFrom(rootProject.file("detekt-config.yml"))
setSource(files(projectDir))
exclude(subprojects.map { "${it.buildDir.relativeTo(rootDir).path}/" })
exclude("**/.gradle/**")
reports {
xml {
enabled = true
destination = file("build/reports/detekt/detekt-results.xml")
}
html.enabled = false
txt.enabled = false
}
}
tasks.register("check") {
group = "Verification"
description = "Allows to attach Detekt to the root project."
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
fun isNonStable(version: String): Boolean {
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return !regex.matches(version)
}