-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
66 lines (57 loc) · 1.73 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
kotlin("jvm") version "1.5.21"
id("org.jetbrains.dokka") version "1.5.0"
jacoco
id("org.sonarqube") version "3.3"
}
group = "rocks.frieler.pbqp"
version = "0.1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
testImplementation("com.willowtreeapps.assertk:assertk-jvm:0.24")
testImplementation("org.mockito.kotlin:mockito-kotlin:3.2.0")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks {
test {
useJUnitPlatform()
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
}
}
register("sourcesJar", Jar::class) {
from(project.sourceSets["main"].allJava.srcDirs)
archiveClassifier.set("sources")
}
register("javadocJar", Jar::class) {
dependsOn(dokkaJavadoc)
from("${buildDir}/dokka/javadoc")
archiveClassifier.set("javadoc")
}
}
sonarqube {
properties {
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.organization", "christopherfrieler")
property("sonar.projectName", "pbqp")
property("sonar.projectKey", "christopherfrieler_pbqp")
when (val analysisType = System.getenv("SONAR_ANALYSIS_TYPE")) {
"branch" -> property("sonar.branch.name", System.getenv("SONAR_BRANCH_NAME"))
"pull_request" -> property("sonar.pullrequest.key", System.getenv("SONAR_PULLREQUEST_KEY"))
else -> logger.warn("unknown SONAR_ANALYSIS_TYPE: '{}'", analysisType)
}
}
}
tasks.sonarqube {
dependsOn(tasks.jacocoTestReport)
}