-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
153 lines (127 loc) · 3.92 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import ru.vyarus.gradle.plugin.mkdocs.task.MkdocsTask
import java.net.URL
plugins {
alias(libs.plugins.kotlin.jvm)
jacoco
`maven-publish`
alias(libs.plugins.ktlint)
alias(libs.plugins.mkdocs)
alias(libs.plugins.dokka)
alias(libs.plugins.jacocolog)
}
group = "com.hypercubetools"
version = "0.1.0"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation(libs.bundles.junit)
testImplementation(libs.hamkrest)
testImplementation(libs.hamcrest)
testRuntimeOnly(libs.junit.engine)
testRuntimeOnly(libs.kotlin.refelction)
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = libs.versions.targetJvm.get()
}
tasks.test {
useJUnitPlatform()
testLogging {
showExceptions = true
showCauses = true
showStackTraces = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
reports.html.required.set(false)
reports.junitXml.required.set(true)
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
element = "BUNDLE"
excludes = listOf("com.jacoco.dto.*")
limit {
counter = "BRANCH"
minimum = BigDecimal(".75")
}
limit {
counter = "INSTRUCTION"
minimum = BigDecimal(".8")
}
}
}
}
tasks.check {
dependsOn(tasks.jacocoTestCoverageVerification)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
html.required.set(true)
xml.required.set(false)
csv.required.set(false)
}
}
fun DokkaTask.dokkaConfig(format: String, outputDir: String) {
outputFormat = format
outputDirectory = outputDir
externalDocumentationLink {
url = URL("https://docs.oracle.com/javase/8/docs/api/")
}
}
// Generate the API documentation as html for javadoc distribution
val dokka by tasks.getting(DokkaTask::class) {
dokkaConfig("html", "$buildDir/javadoc")
}
// Generate the API documentation as markdown for docs site
val dokkaMd by tasks.register<DokkaTask>("dokkaMd") {
dokkaConfig("gfm", "src/doc/docs/api")
}
val packageJavadoc by tasks.registering(Jar::class) {
dependsOn("dokka")
archiveClassifier.set("javadoc")
from(sourceSets.main.get().allSource)
}
publishing {
publications {
register<MavenPublication>("lib") {
from(components["java"])
artifact(tasks.kotlinSourcesJar.get())
artifact(packageJavadoc.get())
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
pom {
name.set(project.name)
description.set("Time manipulation for JVM test cases")
url.set("https://timeslip.hypercubetools.com")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
distribution.set("repo")
}
}
scm {
connection.set("scm:git:git://github.com/plannigan/timeslip")
developerConnection.set("scm:git:git://github.com/plannigan/timeslip")
url.set("https://timeslip.hypercubetools.com")
}
}
}
}
}
mkdocs {
strict = true
python.pip("mkdocs-material:4.4.0", "markdown-include:0.5.1", "markdown-fenced-code-tabs:1.0.5")
}
fun MkdocsTask.dokkaDepends() {
dependsOn("dokkaMd")
}
val mkdocsServe by tasks.getting(MkdocsTask::class) { dokkaDepends() }
val mkdocsBuild by tasks.getting(MkdocsTask::class) { dokkaDepends() }