-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
98 lines (80 loc) · 2.31 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
plugins {
kotlin("jvm") version "1.6.10"
application
jacoco
`project-report`
id("com.github.ben-manes.versions") version "0.39.0"
}
subprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("jacoco")
}
tasks.test {
useJUnitPlatform()
}
}
val logbackDependency = "ch.qos.logback:logback-classic:1.2.8"
allprojects {
group = "me.hltj"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32")
testImplementation(logbackDependency) {
exclude(group = "org.slf4j", module = "slf4j-api")
}
testImplementation(group = "io.kotest", name = "kotest-runner-junit5-jvm", version = "5.0.2")
}
}
repositories {
mavenCentral()
}
val ktorVersion = "1.6.7"
fun ktor(module: String) = "io.ktor:ktor-$module:$ktorVersion"
dependencies {
implementation(project(":share"))
implementation(project(":parser"))
implementation(project(":generator"))
implementation(logbackDependency) {
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(ktor("server-cio"))
implementation(ktor("client-cio"))
testImplementation(ktor("server-test-host"))
}
application.mainClass.set("io.ktor.server.cio.EngineMain")
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
jacoco {
toolVersion = "0.8.7"
}
tasks.jacocoTestReport {
dependsOn(subprojects.map { it.tasks.test })
dependsOn(tasks.test)
dependsOn(tasks.withType<CreateStartScripts>())
executionData(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
subprojects.forEach {
sourceSets(it.sourceSets["main"])
}
reports {
xml.required.set(true)
xml.outputLocation.set(file("$buildDir/reports/jacoco/report.xml"))
csv.required.set(false)
}
}
tasks.dependencyUpdates {
rejectVersionIf {
isNonStable(candidate.version)
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { it in version.toUpperCase() }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return !stableKeyword && !regex.matches(version)
}