jsemver
jsemver copied to clipboard
Access version parts of semantic version
Hey,
this is probably rather a question than an issue, but I did not figure it out yet.
In an Android app I use the following paradigm to create a versionCode
: https://medium.com/@manas/manage-your-android-app-s-versioncode-versionname-with-gradle-7f9c5dcf09bf
In order to make that calculation provided in the link, I need to access the version parts as integers. I know that this is possible with this com.github.zafarkhaja.semver.Version
class, but I could not figure out how to access this from the gradle build script.
So I need something like this:
android {
defaultConfig {
applicationId “something.app”
versionCode scmVersion.version.major * 10000
+ scmVersion.version.minor * 100
+ scmVersion.version.patch
versionName scmVersion.version
}
}
Can you help me out here? I'd rather not parse the version string and split it in parts myself :-)
Thank you guys