Skip to content

Commit 9471475

Browse files
committed
Update Grgit version to 5.3.3
1 parent f5aa4a9 commit 9471475

6 files changed

Lines changed: 440 additions & 39 deletions

File tree

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ root = true
1818
charset = utf-8
1919
end_of_line = lf
2020
insert_final_newline = true
21-
trim_trailing_whitespace = true
21+
# work-around for https://youtrack.jetbrains.com/issue/IDEA-324136
22+
#trim_trailing_whitespace = true
2223
indent_style = space
2324
indent_size = 4
2425

gradle/build-logic/src/main/kotlin/net/kautler/publishing.gradle.kts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import net.kautler.util.Property.Companion.boolean
2323
import net.kautler.util.Property.Companion.optionalString
2424
import net.kautler.util.afterReleaseBuild
2525
import net.kautler.util.beforeReleaseBuild
26+
import net.kautler.util.cachedProvider
2627
import net.kautler.util.createReleaseTag
2728
import net.kautler.util.git
2829
import net.kautler.util.preTagCommit
@@ -48,14 +49,13 @@ import javax.swing.JOptionPane.showOptionDialog
4849
import javax.swing.JScrollPane
4950
import javax.swing.JTextArea
5051
import javax.swing.SwingUtilities
51-
import kotlin.LazyThreadSafetyMode.NONE
5252

5353
plugins {
5454
java
5555
signing
5656
id("de.marcphilipp.nexus-publish")
5757
id("io.codearte.nexus-staging")
58-
id("org.ajoberstar.grgit")
58+
id("org.ajoberstar.grgit.service")
5959
id("net.wooga.github")
6060
id("net.kautler.readme")
6161
}
@@ -179,12 +179,8 @@ release {
179179
}
180180
}
181181

182-
val releasePlugin by lazy(NONE) {
183-
plugins.findPlugin(ReleasePlugin::class)!!
184-
}
185-
186-
val releaseTagName by lazy(NONE) {
187-
releasePlugin.tagName()!!
182+
val releaseTagName = cachedProvider {
183+
plugins.findPlugin(ReleasePlugin::class)!!.tagName()
188184
}
189185

190186
val gitHubToken by optionalString("github.token")
@@ -220,30 +216,38 @@ configure(listOf(tasks.release, tasks.runBuildTasks)) {
220216

221217
tasks.withType<GithubPublish>().configureEach {
222218
onlyIf("only publish release versions to GitHub") { releaseVersion }
223-
tagName = provider { releaseTagName }
224-
releaseName = provider { releaseTagName }
219+
tagName = releaseTagName
220+
releaseName = releaseTagName
225221
}
226222

227223
tasks.githubPublish {
224+
usesService(grgitService.service)
228225
body = provider {
229-
val releaseBody = grgit
230-
.log {
231-
github
232-
.clientProvider
233-
.get()
234-
.getRepository(github.repositoryName.get())
235-
.latestRelease
236-
?.apply {
237-
excludes.add(tagName)
226+
val releaseBody = grgitService
227+
.service
228+
.get()
229+
.findGrgit()
230+
.map {
231+
it
232+
.log {
233+
github
234+
.clientProvider
235+
.get()
236+
.getRepository(github.repositoryName.get())
237+
.latestRelease
238+
?.apply {
239+
excludes.add(tagName)
240+
}
241+
}
242+
.filter { commit ->
243+
!commit.shortMessage.startsWith("[Gradle Release Plugin] ")
244+
}
245+
.asReversed()
246+
.joinToString("\n") { commit ->
247+
"- ${commit.shortMessage} [${commit.id}]"
238248
}
239249
}
240-
.filter { commit ->
241-
!commit.shortMessage.startsWith("[Gradle Release Plugin] ")
242-
}
243-
.asReversed()
244-
.joinToString("\n") { commit ->
245-
"- ${commit.shortMessage} [${commit.id}]"
246-
}
250+
.orElse("")
247251

248252
if (isHeadless()) {
249253
return@provider releaseBody
@@ -254,7 +258,7 @@ tasks.githubPublish {
254258
SwingUtilities.invokeLater {
255259
val initialReleaseBody = """
256260
# Highlights
257-
-
261+
-
258262
259263
# Details
260264
@@ -318,7 +322,7 @@ val finishMilestone by tasks.registering(Github::class) {
318322
listMilestones(OPEN)
319323
.find { it.title == "Next Version" }!!
320324
.apply {
321-
title = releaseTagName
325+
title = releaseTagName.get()
322326
close()
323327
}
324328

0 commit comments

Comments
 (0)