From 38f71460f02795346566423aa0aa444a404db8c8 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 27 Jan 2024 15:02:15 +0530 Subject: [PATCH] refactor(build): defer semver parsing to task execution --- .../claw/gradle/versioning/VersioningPlugin.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/versioning/VersioningPlugin.kt b/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/versioning/VersioningPlugin.kt index cd3499e6..4f4b61af 100644 --- a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/versioning/VersioningPlugin.kt +++ b/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/versioning/VersioningPlugin.kt @@ -70,27 +70,27 @@ class VersioningPlugin : Plugin { val version = versionName.map(Version::parse) tasks.register("clearPreRelease") { description = "Remove the pre-release suffix from the version" - semverString.set(version.get().toStableVersion().toString()) + semverString.set(version.map(Version::toStableVersion).map(Version::toString)) propertyFile.set(propFile) } tasks.register("bumpMajor") { description = "Increment the major version" - semverString.set(version.get().nextMajorVersion().toString()) + semverString.set(version.map(Version::nextMajorVersion).map(Version::toString)) propertyFile.set(propFile) } tasks.register("bumpMinor") { description = "Increment the minor version" - semverString.set(version.get().nextMinorVersion().toString()) + semverString.set(version.map(Version::nextMinorVersion).map(Version::toString)) propertyFile.set(propFile) } tasks.register("bumpPatch") { description = "Increment the patch version" - semverString.set(version.get().nextPatchVersion().toString()) + semverString.set(version.map(Version::nextPatchVersion).map(Version::toString)) propertyFile.set(propFile) } tasks.register("bumpSnapshot") { description = "Increment the minor version and add the `SNAPSHOT` suffix" - semverString.set(version.get().nextMinorVersion("SNAPSHOT").toString()) + semverString.set(version.map { it.nextMinorVersion("SNAPSHOT") }.map(Version::toString)) propertyFile.set(propFile) } afterEvaluate {