From 05c923392b0e0311d1525e93a25059b623e45f35 Mon Sep 17 00:00:00 2001 From: Kevin Galligan Date: Mon, 18 Sep 2023 21:30:35 -0400 Subject: [PATCH] Remove timestamp and clean up version manager --- gradle.properties | 2 +- .../co/touchlab/faktory/KmmBridgeExtension.kt | 6 ------ .../versionmanager/TimestampVersionManager.kt | 21 ------------------- website/docs/PORTING_0.3.x.md | 16 ++++++++++++-- 4 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 kmmbridge/src/main/kotlin/co/touchlab/faktory/versionmanager/TimestampVersionManager.kt diff --git a/gradle.properties b/gradle.properties index ae51da73..613f5a7b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ android.useAndroidX=true org.gradle.jvmargs=-Xmx2g GROUP=co.touchlab.faktory -VERSION_NAME=0.5.1-SNAPSHOT +VERSION_NAME=0.5.1-alpha1 KOTLIN_VERSION=1.8.22 POM_URL=https://github.com/touchlab/KMMBridge diff --git a/kmmbridge/src/main/kotlin/co/touchlab/faktory/KmmBridgeExtension.kt b/kmmbridge/src/main/kotlin/co/touchlab/faktory/KmmBridgeExtension.kt index 21b7885c..a14dc5a8 100644 --- a/kmmbridge/src/main/kotlin/co/touchlab/faktory/KmmBridgeExtension.kt +++ b/kmmbridge/src/main/kotlin/co/touchlab/faktory/KmmBridgeExtension.kt @@ -21,7 +21,6 @@ import co.touchlab.faktory.dependencymanager.DependencyManager import co.touchlab.faktory.dependencymanager.SpecRepo import co.touchlab.faktory.dependencymanager.SpmDependencyManager import co.touchlab.faktory.versionmanager.ManualVersionManager -import co.touchlab.faktory.versionmanager.TimestampVersionManager import co.touchlab.faktory.versionmanager.VersionManager import co.touchlab.faktory.localdevmanager.LocalDevManager import org.gradle.api.Project @@ -76,11 +75,6 @@ interface KmmBridgeExtension { artifactManager.setAndFinalize(MavenPublishArtifactManager(this, publication, repository)) } - @Suppress("unused") - fun timestampVersions() { - versionManager.setAndFinalize(TimestampVersionManager) - } - @Suppress("unused") fun manualVersions() { versionManager.setAndFinalize(ManualVersionManager) diff --git a/kmmbridge/src/main/kotlin/co/touchlab/faktory/versionmanager/TimestampVersionManager.kt b/kmmbridge/src/main/kotlin/co/touchlab/faktory/versionmanager/TimestampVersionManager.kt deleted file mode 100644 index 0c9b16a5..00000000 --- a/kmmbridge/src/main/kotlin/co/touchlab/faktory/versionmanager/TimestampVersionManager.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2023 Touchlab. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package co.touchlab.faktory.versionmanager - -import org.gradle.api.Project - -object TimestampVersionManager : VersionManager { - override fun getVersion(project: Project): String = - "${project.version}.${System.currentTimeMillis()}" -} diff --git a/website/docs/PORTING_0.3.x.md b/website/docs/PORTING_0.3.x.md index fec79568..c07beb84 100644 --- a/website/docs/PORTING_0.3.x.md +++ b/website/docs/PORTING_0.3.x.md @@ -27,7 +27,7 @@ An explicit setting of `versionPrefix` in the plugin config should be removed. B ### VersionWriter and VersionManager -The original KMMBridge had `VersionManager` and `VersionWriter`. These interfaces were responsible for finding and incrementing versions, and for "writing" them. Since KMMBridge is no longer managing versions, these are redundant. As mentioned above, KMMBridge was managing a lot of git commands internally, and all of that is driven by versions. Moving that to CI makes KMMBridge much simpler, and is much easier to reason about and customize. +The original KMMBridge had `VersionManager` and `VersionWriter`. These interfaces were responsible for finding and incrementing versions, and for "writing" them. Since KMMBridge is no longer managing versions, these are redundant. As mentioned above, KMMBridge was managing a lot of git commands internally, and all of that was driven by version management. Moving that to CI makes KMMBridge much simpler, and is much easier to reason about and customize. As a result, the following functions no longer exist in the KMMBridge config block: @@ -35,8 +35,20 @@ As a result, the following functions no longer exist in the KMMBridge config blo * `githubReleaseVersions()` * `githubEnterpriseReleaseVersions()` * `noGitOperations()` +* `timestampVersions()` -`VersionManager` still exists, but it's role has been reduced, and it may be removed entirely at some point. +`VersionManager` still exists, but it's role has been reduced. KMMBridge will take the `version` property from Gradle and use that for it's version in publishing. If you would like some other method of calculating a version string, implement `VersionManager` and set it with the following: + +```kotlin +object MyVersionManager : VersionManager { + override fun getVersion(project: Project): String = "0.1.${System.currentTimeMillis()}" +} + +kmmbridge { + // Etc + versionManager.set(MyVersionManager) +} +``` ## Migrating