axion-release-plugin icon indicating copy to clipboard operation
axion-release-plugin copied to clipboard

How to check if current version is a snapshot programatically

Open solonovamax opened this issue 2 years ago • 1 comments

How would one check if the current version is a snapshot programmatically?

Currently, I am using

val Project.isSnapshot: Boolean
    get() = version.toString().endsWith("-SNAPSHOT")

however, this feels sub-par.

There currently exists a class VersionContext, which contains the field snapshot, which is what I'd like to use, however there is no easy way to get this. It would be nice if this was exposed publicly (Or some other way to check if the current version is a snapshot)

solonovamax avatar Nov 20 '23 02:11 solonovamax

hi, sure, i think it could be useful, I'll be happy to merge such PR :)

bgalek avatar Nov 29 '23 22:11 bgalek