-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
122 lines (98 loc) · 3.41 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
import com.vanniktech.maven.publish.SonatypeHost
plugins {
kotlin("jvm") version "2.1.0"
id("com.vanniktech.maven.publish") version "0.30.0"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
id("org.jetbrains.kotlinx.kover") version "0.9.0"
id("org.jetbrains.dokka") version "2.0.0"
id("org.sonarqube") version "6.0.1.5171"
`java-library`
}
group = "org.javafreedom"
project.version = project.findProperty("version") as String? ?: "0.0.1-SNAPSHOT"
val kotlinxDatetimeVersion = "0.6.1"
val konsistVersion = "0.17.3"
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:${kotlinxDatetimeVersion}")
testImplementation(kotlin("test"))
testImplementation("com.lemonappdev:konsist:${konsistVersion}")
}
tasks.test {
useJUnitPlatform()
testLogging.showStandardStreams = true
}
detekt {
ignoreFailures = true
}
val version: String by lazy {
project.findProperty("version")?.toString() ?: "0.0.0-SNAPSHOT"
}
mavenPublishing {
println("Using Version: ${version}")
coordinates(groupId = group.toString(), artifactId = rootProject.name, version = version)
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
pom {
name.set("KHol")
description.set("Kotlin Holidays - A library to provide a list of holidays.")
inceptionYear.set("2024")
url.set("https://github.com/triplem/khol/")
licenses {
license {
name.set("MIT License")
url.set("http://www.opensource.org/licenses/mit-license.php")
}
}
developers {
developer {
id.set("triplem")
name.set("Markus M. May")
url.set("https://github.com/triplem/")
}
}
scm {
url.set("https://github.com/triplem/khol/")
connection.set("scm:git:git://github.com/triplem/khol.git")
developerConnection.set("scm:git:ssh://[email protected]/triplem/khol.git")
}
}
signAllPublications()
}
kover.reports.verify.rule {
minBound(50)
}
sonarqube {
properties {
property("sonar.projectName", "khol")
property("sonar.projectKey", "triplem_khol")
property("sonar.organization", "triplem")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.kotlin.detekt.reportPaths",
project.layout.buildDirectory.file("reports/detekt/detekt.xml").get().asFile)
property("sonar.coverage.jacoco.xmlReportPaths",
project.layout.buildDirectory.file("reports/kover/report.xml").get().asFile)
}
}
tasks.register("prepareDocs") {
group = "documentation"
description = "Prepare GitHub Pages documentation."
dependsOn(tasks.dokkaGeneratePublicationHtml, tasks.koverHtmlReport, tasks.test)
val outputDir = project.layout.projectDirectory.dir("docs")
doLast {
copy {
from(tasks.dokkaGeneratePublicationHtml.get().outputDirectory)
into(outputDir.dir("dokka"))
}
copy {
from(project.layout.buildDirectory.dir("reports/kover/html"))
into(outputDir.dir("kover"))
}
copy {
from(project.layout.buildDirectory.dir("reports/detekt"))
into(outputDir.dir("detekt"))
}
copy {
from(project.layout.buildDirectory.dir("reports/tests/test"))
into(outputDir.dir("tests"))
}
}
}