-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
154 lines (139 loc) · 4.44 KB
/
build.gradle.kts
File metadata and controls
154 lines (139 loc) · 4.44 KB
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
154
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.nexus.publish)
alias(libs.plugins.git.version)
jacoco
`maven-publish`
signing
}
group = "io.github.abaddon.kcqrs"
object Meta {
const val desc = "KCQRS Core library"
const val license = "Apache-2.0"
const val githubRepo = "abaddon/kcqrs-core"
const val developerName = "Stefano Longhi"
const val developerOrganization = ""
const val organizationUrl = "https://github.com/abaddon"
}
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val details = versionDetails()
val lastTag = details.lastTag
val snapshotTag = {
val list = lastTag.split(".")
val third = (list.last().toInt() + 1).toString()
"${list[0]}.${list[1]}.$third-SNAPSHOT"
}
version = if (details.isCleanTag) lastTag else snapshotTag()
repositories {
mavenCentral()
maven {
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
mavenContent {
snapshotsOnly()
}
}
mavenLocal()
}
dependencies {
//Core
compileOnly(libs.bundles.log)
implementation(libs.bundles.ksqrs.core)
//Test
testImplementation(kotlin("test"))
testImplementation(libs.bundles.log.test)
testImplementation(libs.bundles.ksqrs.core.test)
}
jacoco {
toolVersion = "0.8.10"
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco"))
}
}
kotlin {
jvmToolchain(21)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21)) // Added to explicitly set Java toolchain
}
withSourcesJar()
withJavadocJar()
}
signing {
val signingKey = providers
.environmentVariable("GPG_SIGNING_KEY")
val signingPassphrase = providers
.environmentVariable("GPG_SIGNING_PASSPHRASE")
if (signingKey.isPresent && signingPassphrase.isPresent) {
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
val extension = extensions
.getByName("publishing") as PublishingExtension
sign(extension.publications)
}
}
publishing {
publications {
create<MavenPublication>("kcqrs-core") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
// from(components["kotlin"]) - This line was commented out in the original
artifact(tasks["jar"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set(project.name)
description.set(Meta.desc)
url.set("https://github.com/${Meta.githubRepo}")
licenses {
license {
name.set(Meta.license)
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
name.set(Meta.developerName)
organization.set(Meta.developerOrganization)
organizationUrl.set(Meta.organizationUrl)
}
}
scm {
url.set(
"https://github.com/${Meta.githubRepo}.git"
)
connection.set(
"scm:git:git://github.com/${Meta.githubRepo}.git"
)
developerConnection.set(
"scm:git:git://github.com/${Meta.githubRepo}.git"
)
}
issueManagement {
url.set("https://github.com/${Meta.githubRepo}/issues")
}
}
}
}
}
nexusPublishing {
repositories {
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username = providers.environmentVariable("SONATYPE_USERNAME")
password = providers.environmentVariable("SONATYPE_TOKEN")
}
}
}