Hey guys, question related to KMMBridge. I’m tryin...
# touchlab-tools
l
Hey guys, question related to KMMBridge. I’m trying to run snapshot builds from a GHAction script. Could this work by simply writing a custom
VersionWriter
to append ‘-Snapshot’ to the end of a version when a certain environment variable is passed from the CI script before running the
call-kmmbridge-publish
step? I know the plugin doesn’t explicitly support snapshot builds, but would this be the best way of going about it for now?
r
yeah, a custom version writer should be able to do this. I sketched out this in response to a similar question at one point but have never tested it
Copy code
class SuffixedVersionWriter(private val suffix: String, private val delegate: VersionWriter): VersionWriter by delegate {
    override fun scanVersions(project: Project, block: (Sequence<String>) -> Unit) {
        delegate.scanVersions(project) { sequence ->  
            block(sequence.map { it.removeSuffix(suffix) })
        }
    }

    override fun writeMarkerVersion(project: Project, version: String) {
        delegate.writeMarkerVersion(project, version + suffix)
    }

    override fun writeFinalVersion(project: Project, version: String) {
        delegate.writeFinalVersion(project, version + suffix)
    }
}