View on GitHub

AnVerGen

An automatic version generator for Android applications.

Download this project as a .zip file Download this project as a tar.gz file

AnVerGen - Android Version Generator

Travis AppVeyor CodeCov VersionEye

Releases Bintray JitPack

An automatic version generator for Android applications, implemented by Groovy.

Usage

It is a git based version generator, and git tags, especially annotated and signed tags, are the most important references.

Generate with git

The version code will be the commit count of git, and the version name will be a result of git describe.

Finally, the version name is something like 0.5.0 at the tag 0.5.0, and 0.4.0-8-g8292719 at the commit 0.5.0^.

As you see, the tag name of your git repository is recommended to be something like 0.1.0, 1.0.0. It’s strongly recommended to read Semantic Versioning for help.

Add to dependency

It’s a version generator used in the gradle build script.

It’s not a dependency of an application, but a dependency of a gradle build script, so there is a little difference from other JARs.

Modify the build.gradle in the root directory. You can get this JAR from Bintray:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.no_creativity:AnVerGen:1.0.0'
    }
}

Or JitPack:

buildscript {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.github.no-creativity:AnVerGen:1.0.0'
    }
}

You can see the latest dependency snippet by clicking the badges Download or JitPack.

Invoke in the build script

import org.no_creativity.anvergen.Ver

android {
    defaultConfig {
        versionCode Ver.generateVersionCode()
        versionName Ver.generateVersionName()
    }
}

You can read the groovydoc for more usages.

Change request

If there is any new demand or problem of this JAR, please give me an issue.

Or you can fork and distribute it.

License

License

   AnVerGen - Android Version Generator
   Copyright 2016 Yan QiDong

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.