From c285c3e0d159ef0f8a8c05880128c5aef49b973d Mon Sep 17 00:00:00 2001 From: Michio Nakagawa Date: Thu, 13 Jan 2022 22:19:47 +0900 Subject: [PATCH] fix: insert changelog #20 --- .../com/github/rising3/gradle/semver/tasks/SemVerTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/groovy/com/github/rising3/gradle/semver/tasks/SemVerTask.groovy b/src/main/groovy/com/github/rising3/gradle/semver/tasks/SemVerTask.groovy index 3b76981..a9ba2a1 100644 --- a/src/main/groovy/com/github/rising3/gradle/semver/tasks/SemVerTask.groovy +++ b/src/main/groovy/com/github/rising3/gradle/semver/tasks/SemVerTask.groovy @@ -165,10 +165,10 @@ class SemVerTask extends DefaultTask { if (ChangeLog.FILE == project.semver.changeLog || ChangeLog.BOTH == project.semver.changeLog) { final changelog = Paths.get("$project.rootDir/CHANGELOG.md") final changelogBak = Paths.get("${changelog}.bak") + def tmp = Files.exists(changelog) ? changelog.getText('UTF-8') : '' if (Files.exists(changelog) && !project.semver.noBackupChangelog) { Files.copy(changelog, changelogBak, StandardCopyOption.REPLACE_EXISTING) } - def tmp =Files.exists(changelogBak) ? changelogBak.getText('UTF-8') : '' changelog.withWriter 'UTF-8', {it << logBody + tmp } files.push(changelog.getFileName().toString()) }