From c4b44f431c3aa72f74ea7a9c198182f1a6271008 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 1 Apr 2022 00:01:35 -0400 Subject: [PATCH] Resolved #221 corrects release notes Release notes when prefixNameWithV==false is corrected by finding the previous tag --- .../ReleasePluginIntegrationSpec.groovy | 28 +++++++++++++++++++ .../plugin/release/ReleasePlugin.groovy | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy index dca68ab8..6f83a055 100644 --- a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy @@ -881,6 +881,34 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec { new File(projectDir, "build/libs/${moduleName}-0.1.0.jar").exists() } + def 'prefixNameWithV is false tag strategy works as expected with build message finding previous tag version'() { + buildFile << '''\ + release { + tagStrategy { + prefixNameWithV = false + } + } + '''.stripIndent() + git.add(patterns: ['build.gradle'] as Set) + git.commit(message: 'setting tag strategy') + + git.tag.add(name: '0.2.0') + + new File(projectDir, 'test.txt').text = 'test' + git.add(patterns: ['test.txt']) + git.commit(message: 'Add file') + + when: + runTasksSuccessfully('final') + + then: + new File(projectDir, "build/libs/${moduleName}-0.3.0.jar").exists() + Tag tag = originGit.tag.list().find { it.name.contains("0.3.0") } + tag.shortMessage.contains("Release of 0.3.0") + tag.fullMessage.contains("Add file") + !tag.fullMessage.contains("setting tag strategy") + } + def 'use last tag with custom tag strategy'() { buildFile << '''\ release { diff --git a/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy b/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy index 79a62b36..714e0ba5 100644 --- a/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy +++ b/src/main/groovy/nebula/plugin/release/ReleasePlugin.groovy @@ -111,7 +111,7 @@ class ReleasePlugin implements Plugin { builder << "Release of ${version.version}\n\n" if (version.previousVersion) { - String previousVersion = "v${version.previousVersion}^{commit}" + String previousVersion = "${project.release.tagStrategy.toTagString(version.previousVersion)}^{commit}" List excludes = [] if (tagExists(grgit, previousVersion)) { excludes << previousVersion