Skip to content

X2Mobile/gradle-versioncode-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release

gradle-versioncode-plugin

Gradle plugin to manage an application version code inside its continuous integration lifecycle.

This plugin was developed for the REST service: version-code-service.

Usage

Setup buildscript Dependencies

The plugin is available in JitPack. Just add the following to your buildscript dependencies:

buildscript {

    repositories {
    	....
        maven {
            url "https://jitpack.io"
        }
    }
    
    dependencies {
    	...
        classpath 'com.github.Mindera:gradle-versioncode-plugin:1.4'
    }
}

Apply it:

apply plugin: 'com.mindera.gradle.versioncode'

If you are using android flavors, this will generate a task for each combination of flavor and build type that are not debuggable.

For instance, if you have:

productFlavors {
        pro {
            applicationId = "com.example.my.pkg.pro"
        }
        free {
            applicationId = "com.example.my.pkg.free"
        }
    }

This plugin will generate the tasks:

incrementVersionCodeProRelease
incrementVersionCodeFreeRelease

Note: When using flavors, if you set the appVersionCode.appId it will be used for every flavor, if not it will use the value in applicationId.

Tasks Configuration

appVersionCode {
    appId = <app identifier> (do not use if you are using flavors)
    serviceEndpoint = <version code service endpoint>
}

Increment App's Version Code

Use the task 'incrementVersionCode'. For instance, in the command line type:

$ ./gradlew incrementVersionCode

If you're using android flavors, you could run:

$ ./gradlew incrementVersionCodeProRelease

Retrieve App's Current Version Code

import com.mindera.gradle.versioncode.utils.VersionCodeService
apply plugin: 'com.mindera.gradle.versioncode'
(...)
VersionCodeService versionCodeService = new VersionCodeService(<version code service endpoint>, <app identifier>)
return versionCodeService.currentVersionCode()

Dependencies

License

version-code-service is available under the MIT license. See the LICENSE file for more info.

About

Gradle plugin to manage an application version code inside its continuous integration lifecycle.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Groovy 100.0%