diff options
Diffstat (limited to 'build-logic/src/main/kotlin')
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningPlugin.kt | 14 | ||||
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningTask.kt | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningPlugin.kt index b6b0a4ad..8ba800b5 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningPlugin.kt @@ -8,7 +8,7 @@ package app.passwordstore.gradle.versioning import com.android.build.api.variant.ApplicationAndroidComponentsExtension import com.android.build.api.variant.VariantOutputConfiguration import com.android.build.gradle.internal.plugins.AppPlugin -import com.vdurmont.semver4j.Semver +import com.github.zafarkhaja.semver.Version import java.util.Properties import java.util.concurrent.atomic.AtomicBoolean import org.gradle.api.Plugin @@ -56,30 +56,30 @@ class VersioningPlugin : Plugin<Project> { } } } - val version = Semver(versionName) + val version = Version.parse(versionName) tasks.register<VersioningTask>("clearPreRelease") { description = "Remove the pre-release suffix from the version" - semverString.set(version.withClearedSuffix().toString()) + semverString.set(version.toStableVersion().toString()) propertyFile.set(propFile) } tasks.register<VersioningTask>("bumpMajor") { description = "Increment the major version" - semverString.set(version.withIncMajor().withClearedSuffix().toString()) + semverString.set(version.nextMajorVersion().toString()) propertyFile.set(propFile) } tasks.register<VersioningTask>("bumpMinor") { description = "Increment the minor version" - semverString.set(version.withIncMinor().withClearedSuffix().toString()) + semverString.set(version.nextMinorVersion().toString()) propertyFile.set(propFile) } tasks.register<VersioningTask>("bumpPatch") { description = "Increment the patch version" - semverString.set(version.withIncPatch().withClearedSuffix().toString()) + semverString.set(version.nextPatchVersion().toString()) propertyFile.set(propFile) } tasks.register<VersioningTask>("bumpSnapshot") { description = "Increment the minor version and add the `SNAPSHOT` suffix" - semverString.set(version.withIncMinor().withSuffix("SNAPSHOT").toString()) + semverString.set(version.nextMinorVersion("SNAPSHOT").toString()) propertyFile.set(propFile) } afterEvaluate { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningTask.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningTask.kt index 7eb19a89..306311e9 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningTask.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/versioning/VersioningTask.kt @@ -5,7 +5,7 @@ package app.passwordstore.gradle.versioning -import com.vdurmont.semver4j.Semver +import com.github.zafarkhaja.semver.Version import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty import org.gradle.api.provider.Property @@ -21,11 +21,11 @@ abstract class VersioningTask : DefaultTask() { @get:OutputFile abstract val propertyFile: RegularFileProperty /** Generate the Android 'versionCode' property */ - private fun Semver.androidCode(): Int { - return major * 1_00_00 + minor * 1_00 + patch + private fun Version.androidCode(): Long { + return majorVersion() * 1_00_00 + minorVersion() * 1_00 + patchVersion() } - private fun Semver.toPropFileText(): String { + private fun Version.toPropFileText(): String { val newVersionCode = androidCode() val newVersionName = toString() return buildString { @@ -45,6 +45,6 @@ abstract class VersioningTask : DefaultTask() { @TaskAction fun execute() { - propertyFile.get().asFile.writeText(Semver(semverString.get()).toPropFileText()) + propertyFile.get().asFile.writeText(Version.parse(semverString.get()).toPropFileText()) } } |