Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access version parts of semantic version #43

Closed
schmitzhermes opened this issue Apr 10, 2018 · 1 comment
Closed

Access version parts of semantic version #43

schmitzhermes opened this issue Apr 10, 2018 · 1 comment

Comments

@schmitzhermes
Copy link

schmitzhermes commented Apr 10, 2018

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

heisluft added a commit to AntiLaby/jsemver that referenced this issue Feb 1, 2019
@zafarkhaja
Copy link
Owner

Hello @schmitzhermes! Sorry it took me this long to get back to you.

If by some chance it's relevant to you, you can try the following

version.majorVersion
version.minorVersion
version.patchVersion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants