Skip to content

Access version parts of semantic version #43

Description

@schmitzhermes

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions