From 4a5cc5416a331ed5010d498a3429763ffe5dde3e Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 12 Aug 2024 13:34:08 +0200 Subject: [PATCH] fix computing the next version --- .../com/gradleup/librarian/core/tooling/semver.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/librarian-core/src/main/kotlin/com/gradleup/librarian/core/tooling/semver.kt b/librarian-core/src/main/kotlin/com/gradleup/librarian/core/tooling/semver.kt index b883bc4..f0d3549 100644 --- a/librarian-core/src/main/kotlin/com/gradleup/librarian/core/tooling/semver.kt +++ b/librarian-core/src/main/kotlin/com/gradleup/librarian/core/tooling/semver.kt @@ -95,10 +95,16 @@ fun Version.nextMinor(): Version { } fun Version.next(): Version { - return if (preRelease != null) { - copy(preRelease = preRelease.copy(version = preRelease.version + 1), isSnapshot = false) - } else { - copy(patch = patch + 1, isSnapshot = false) + return when { + isSnapshot -> { + copy(isSnapshot = false) + } + preRelease != null -> { + copy(preRelease = preRelease.copy(version = preRelease.version + 1), isSnapshot = false) + } + else -> { + copy(patch = patch + 1, isSnapshot = false) + } } }