-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
135 lines (122 loc) · 4 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
import org.gradle.jvm.toolchain.JvmVendorSpec.ADOPTIUM
import java.util.Base64
plugins {
id("com.diffplug.spotless") version "6.17.0"
id("maven-publish")
id("signing")
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
apply {
plugin("java")
plugin("maven-publish")
plugin("signing")
}
group = "io.github.upmc-enterprises"
version = "2.0.0"
extra["spring-boot.version"] = "3.0.5"
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(ADOPTIUM)
}
withSourcesJar()
withJavadocJar()
}
configure<SigningExtension> {
val signingKeyProperty = findProperty("signingKey") as String?
val signingKeyPassword = findProperty("signingPassword") as String?
if (signingKeyProperty != null && signingKeyPassword != null) {
val signingKey = String(Base64.getDecoder().decode(signingKeyProperty))
val extension = project.extensions.create("SigningExtension", SigningExtension::class)
extension.useInMemoryPgpKeys(signingKey, signingKeyPassword)
sign(publishing.publications)
} else {
logger.quiet("Cannot find signingKey and/or signingPassword. Publications will not be signed.")
}
}
configure<PublishingExtension> {
repositories {
maven {
if (project.hasProperty("CI")) {
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/releases")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
url = if (project.hasProperty("release")) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = findProperty("ossrhUsername").toString()
password = findProperty("ossrhPassword").toString()
}
} else {
url = if (project.hasProperty("release")) {
layout.buildDirectory.dir("repos/releases")
.get().asFile.toURI()
} else {
layout.buildDirectory.dir("repos/snapshots").get().asFile.toURI()
}
}
logger.lifecycle("Publishing artifacts to {}", url)
}
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf(configurations.get("runtimeClasspath"))
}
usage("java-runtime") {
fromResolutionResult()
}
}
afterEvaluate {
artifactId = "upmc-enterprises-graceful-shutdown-spring-boot-${project.base.archivesName.get()}"
version = if (project.hasProperty("release")) version else "$version-SNAPSHOT"
}
pom {
name.set("UPMC Enterprises Graceful Shutdown Spring Boot Starter")
description.set("A Spring Boot starter that enables Spring's graceful shutdown support and supplies actuator endpoints that can be used as a preStop hook for Kubernetes.")
url.set("https://github.com/upmc-enterprises/graceful-shutdown-spring-boot-starter")
licenses {
license {
name.set("MIT License")
url.set("http://www.opensource.org/licenses/mit-license.php")
}
}
scm {
url.set("https://github.com/upmc-enterprises/graceful-shutdown-spring-boot-starter")
}
developers {
developer {
name.set("Bill Koch")
email.set("kochwm@upmc.edu")
organization.set("UPMC Enterprises")
organizationUrl.set("https://enterprises.upmc.com")
}
}
}
}
}
}
}
spotless {
java {
target("**/*.java")
googleJavaFormat()
toggleOffOn()
endWithNewline()
}
kotlinGradle {
ktlint("0.47.1").editorConfigOverride(mapOf("ktlint_code_style" to "official", "indent_size" to "2", "indent_style" to "space"))
toggleOffOn()
endWithNewline()
}
freshmark {
target("**/*.md")
indentWithSpaces(2)
endWithNewline()
}
}