-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
117 lines (89 loc) · 2.91 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
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration
plugins {
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
application
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
id("org.jlleitschuh.gradle.ktlint-idea") version "10.2.1"
id("io.gitlab.arturbosch.detekt") version "1.19.0"
id("org.jetbrains.dokka") version "1.6.10" // dokkaHtml not working, but OUTPUT_SIZE in build if version >= 1.6.20
id("com.adarshr.test-logger") version "3.1.0"
jacoco
id("org.barfuin.gradle.jacocolog") version "2.0.0"
}
buildscript {
// Import the scripts defining the `DokkaBaseConfiguration` class and the like.
// This is to be able to configure the HTML Dokka plugin (custom styles, etc.)
// Note: this can't be put in buildSrc unfortunately
dependencies {
// classpath("org.jetbrains.dokka:dokka-base:1.6.21")
classpath("org.jetbrains.dokka:dokka-base:1.6.10")
}
}
group = "ru.hse.sd.rgb"
version = "1.0"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
implementation("com.charleskorn.kaml:kaml:0.45.0")
testImplementation(kotlin("test"))
// dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.21")
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.10")
}
tasks.test {
useJUnitPlatform()
}
application {
mainClass.set("ru.hse.sd.rgb.MainKt")
}
tasks.withType<Jar> { // build proper .jar will all dependencies
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes["Main-Class"] = "ru.hse.sd.rgb.MainKt"
}
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
detekt {
buildUponDefaultConfig = true
config = files("$projectDir/config/detekt.yml")
}
tasks.dokkaHtml.configure {
dokkaSourceSets {
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
customAssets = listOf(file("rgb-logo.png"))
customStyleSheets = listOf(file("config/dokka/logo-styles.css"))
}
}
}
tasks.register("lint") {
dependsOn("detekt", "ktlintCheck")
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
html.required.set(true)
xml.required.set(false)
csv.required.set(false)
}
finalizedBy("jacocoTestCoverageVerification")
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = "0.0".toBigDecimal() // TODO: increase limit
}
}
}
}