All Projects → rockerhieu → Versionberg

rockerhieu / Versionberg

Licence: MIT license
Gradle plugin for versioning your library/application on every git commit

Programming Languages

groovy
2714 projects
shell
77523 projects

Projects that are alternatives of or similar to Versionberg

gradle-semantic-build-versioning
Gradle plugin to generate version-numbers and tags using semantic versioning
Stars: ✭ 19 (-75.64%)
Mutual labels:  gradle-plugin, versioning
Aspnet Api Versioning
Provides a set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
Stars: ✭ 2,154 (+2661.54%)
Mutual labels:  versioning, versioning-semantics
aspnet-api-versioning
Provides a set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
Stars: ✭ 2,396 (+2971.79%)
Mutual labels:  versioning, versioning-semantics
Maven Git Versioning Extension
This extension will virtually set project versions, based on current git branch or tag.
Stars: ✭ 178 (+128.21%)
Mutual labels:  gradle-plugin, versioning
Reckon
Infer a project's version from your Git repository.
Stars: ✭ 124 (+58.97%)
Mutual labels:  gradle-plugin, versioning
gradle-git-versioning-plugin
This extension will set project version, based on current Git branch or tag.
Stars: ✭ 44 (-43.59%)
Mutual labels:  gradle-plugin, versioning
fastlane-plugin-versioning android
Android Versioning Plugin for Fastlane
Stars: ✭ 113 (+44.87%)
Mutual labels:  versioning, versioning-semantics
Axion Release Plugin
Gradle release & version management plugin.
Stars: ✭ 372 (+376.92%)
Mutual labels:  gradle-plugin, versioning
Versioning
Gradle plug-in to generate version information from the SCM branch (Git or Svn)
Stars: ✭ 157 (+101.28%)
Mutual labels:  gradle-plugin, versioning
Gradle Android Git Version
A gradle plugin to calculate Android-friendly version names and codes from git tags
Stars: ✭ 227 (+191.03%)
Mutual labels:  gradle-plugin, versioning
editorconfig-gradle-plugin
A Gradle plugin for checking whether project files comply with format rules defined in .editorconfig files and eventually also for fixing the violations
Stars: ✭ 40 (-48.72%)
Mutual labels:  gradle-plugin
gradle-natives
Gradle plugin to aid in managing native libraries associated with Java-based projects.
Stars: ✭ 32 (-58.97%)
Mutual labels:  gradle-plugin
version-sync
Keep version numbers in sync with Cargo.toml
Stars: ✭ 65 (-16.67%)
Mutual labels:  versioning
Android-So-Handler
支持APK包中所有System.Load/LoadLibrary加载的So库文件(Maven、aar文件引入三方库、源码引入的so文件),对So文件进行7z压缩与云端下发,完成apk瘦身
Stars: ✭ 64 (-17.95%)
Mutual labels:  gradle-plugin
gradle-syntastic-plugin
A Gradle plugin for integrating your Java project with Vim and Syntastic.
Stars: ✭ 45 (-42.31%)
Mutual labels:  gradle-plugin
jacoco-gradle-testkit-plugin
Gradle plugin for JaCoCo code coverage in tests using Gradle TestKit
Stars: ✭ 37 (-52.56%)
Mutual labels:  gradle-plugin
AndroidLintReporter
Gradle Plugin to report Android Lint and Detekt result back to Github Pull Request
Stars: ✭ 22 (-71.79%)
Mutual labels:  gradle-plugin
Avito Android
Infrastructure of Avito android
Stars: ✭ 253 (+224.36%)
Mutual labels:  gradle-plugin
Coveralls Gradle Plugin
👨‍🔧 gradle plugin for coveralls
Stars: ✭ 250 (+220.51%)
Mutual labels:  gradle-plugin
QuitStore
🖧 Quads in Git - Distributed Version Control for RDF Knowledge Bases
Stars: ✭ 87 (+11.54%)
Mutual labels:  versioning

CircleCI Versionberg on Maven Central

Versionberg

Gradle plugin for versioning your library/application on every git commit.

image

(Generated by Breaking Bad Generator)

Usage

You can use the new plugin syntax for gradle 2.1+:

plugins {
  id "io.github.rockerhieu.versionberg" version "<latest-version>"
}

Or the legacy way:

buildscript {
   repositories {
       maven { url "https://plugins.gradle.org/m2/" } // or jcenter()
   }
   dependencies {
       classpath 'io.github.rockerhieu:versionberg:<latest-version>'
   }
}

apply plugin: 'io.github.rockerhieu.versionberg'

Gradle tasks

versionbergInfo: print version info into the console, e.g:

$ ./gradlew versionbergInfo
$ Versionberg: 
          major: 1
          minor: 0
          patch: 10
          build: 25
          commitSha: d48434f
          commitCount: 25
          code: 1000000025
          name: 1.0.d48434f-SNAPSHOT
          gitDir: null

Java

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" } // or jcenter()
    }
    dependencies {
        classpath 'io.github.rockerhieu:versionberg:<latest-version>'
    }
}

apply plugin: 'io.github.rockerhieu.versionberg'
apply plugin: 'java'

versionberg {
    major 1
    minor 0
    patch 0
}

version = versionberg.name

Android

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" } // or jcenter()
    }
    dependencies {
        classpath 'io.github.rockerhieu:versionberg:<latest-version>'
    }
}

apply plugin: 'io.github.rockerhieu.versionberg'
apply plugin: 'com.android.application'

versionberg {
    major 1
    minor 0
    patch 0
}

android {
    defaultConfig {
        versionCode versionberg.code
        versionName versionberg.name
    }
}

Advanced usage

Custom git repo

By default the plugin will try to find the git repo in the root project directory. But you can change it to any git repo that you want by setting gitDir:

versionberg {
    major 1
    minor 0
    gitDir new File("path/to/git/repo/.git")
}

Template

You can define template for version name and version code if you don't want to use the default settings provided by Versionberg

versionberg {
    // Increase when you make incompatible API changes (default value is 0)
    major 1

    // Increase when you add functionality in a backwards-compatible manner (default value is 0)
    minor 0

    // Increase when you make backwards-compatible bug fixes (default value is 0)
    patch 0

    // default is ${commitCount}, uncomment to use a custom build number
    // build 2

    // Default version name template is '${major}.${minor}.${patch}.${build}'
    nameTemplate '${major}.${minor}.${new Date().format("ddMMyyyy")}-SNAPSHOT'
    
    // Default version code template is '${build}'
    codeTemplate '(((${major} * 100) + ${minor}) * 100) * 100000 + ${build}'
}

You can put date into the template, i.e ${new Date().format("ddMMyyyy")}, see more at SimpleDateFormat.

See Advanced Usage for the list of all available variables can be used in nameTemplate and codeTemplate.

My config

This is the config that I been using for some years:

versionberg {
    major 1
    minor 0
    nameTemplate '${major}.${minor}.${commitCount}.${commitSha}'
    codeTemplate '(((${major} * 100) + ${minor}) * 100) * 100000 + ${build}'
}

Example value:

major: 1
minor: 0
patch: 0
build: 12
commitSha: 9a35eb9
commitCount: 12
code: 1000000012
name: 1.0.12.9a35eb9

Main advantages:

  • ${commitCount}: easy to reference to a version when communicating
  • ${commitSha}: easy to identify the git revision of a given build

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

License

Copyright (c) 2016 Hieu Rocker

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].