This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
128 lines (104 loc) · 3.37 KB
/
build.gradle
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
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion"
classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion"
}
}
// Shared config
allprojects {
/// Plugins
// Compilation
apply plugin: "java"
apply plugin: "kotlin"
// Documentation
apply plugin: "org.jetbrains.dokka"
// Static analysis
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: "jacoco"
/// Dependencies
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlinVersion
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlinVersion
implementation group: "io.github.microutils", name: "kotlin-logging", version: kotlinLoggingVersion
testCompile group: "org.assertj", name: "assertj-core", version: assertjVersion
testCompile group: "org.jetbrains.spek", name: "spek-api", version: spekVersion
testRuntime group: "org.jetbrains.spek", name: "spek-junit-platform-engine", version: spekVersion
testCompile group: "org.junit.jupiter", name: "junit-jupiter-engine", version: junitVersion
}
/// Configuration
// Kotlin
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
// JUnit / Spek
test {
testLogging {
exceptionFormat = "full"
}
useJUnitPlatform() {
includeEngines "junit-jupiter", "spek"
}
}
// Spotless
spotless {
kotlin {
ktlint()
}
}
// Jacoco
test {
jacoco {
append = true
destinationFile = file("$buildDir/jacoco/test.exec")
}
}
jacoco {
toolVersion = jacocoVersion
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
executionData = files("$buildDir/jacoco/test.exec")
reports {
csv.enabled = false
html.enabled = true
xml.enabled = true
}
}
}
// Global config
apply from: "gradle/detekt.gradle"
// Jacoco report combining all reports
task jacocoRootReport(type: JacocoReport) {
dependsOn = allprojects.test
additionalSourceDirs = files(allprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(allprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(allprojects.sourceSets.main.output)
executionData = files(allprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
onlyIf = { true }
}