{"id":15134420,"url":"https://github.com/davideas/grabver","last_synced_at":"2025-10-23T11:30:27.686Z","repository":{"id":94799103,"uuid":"91992959","full_name":"davideas/GrabVer","owner":"davideas","description":"Gradle Automatic Build Versioning Plugin - An easy Gradle plugin that follows semver.org rules to automatically generate the Patch version, Build number and Code version, while Major, Minor and Pre-Release suffix remain under our control.","archived":false,"fork":false,"pushed_at":"2024-08-01T14:12:55.000Z","size":164,"stargazers_count":39,"open_issues_count":5,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-30T17:38:42.813Z","etag":null,"topics":["android-studio","auto-reset","automatic-versioning","build","build-versioning","gradle","intellij-idea","semver","version","versioning"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davideas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-21T23:04:11.000Z","updated_at":"2024-08-01T14:07:24.000Z","dependencies_parsed_at":"2023-03-31T03:48:47.567Z","dependency_job_id":null,"html_url":"https://github.com/davideas/GrabVer","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideas%2FGrabVer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideas%2FGrabVer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideas%2FGrabVer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideas%2FGrabVer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davideas","download_url":"https://codeload.github.com/davideas/GrabVer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237811515,"owners_count":19370144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-studio","auto-reset","automatic-versioning","build","build-versioning","gradle","intellij-idea","semver","version","versioning"],"created_at":"2024-09-26T05:20:35.541Z","updated_at":"2025-10-23T11:30:22.361Z","avatar_url":"https://github.com/davideas.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gradle](https://img.shields.io/badge/Gradle-Plugin-green.svg)](https://plugins.gradle.org/plugin/eu.davidea.grabver)\n[![Gradle](https://img.shields.io/badge/Android-√-darkgreen.svg)](https://developer.android.com)\n[![Gradle](https://img.shields.io/badge/Spring_Boot-√-darkgreen.svg)](https://spring.io/projects/spring-boot)\n[![Licence](https://img.shields.io/badge/Licence-Apache2-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\n![Logo](./art/grabver.png)\n\nAn easy Gradle plugin that follows [semver.org](http://semver.org/) rules to\nautomatically generate the _Patch_ version, _Build_ number and _Code_ version, while _Major_,\n_Minor_ and _Pre-Release_ suffix remain under our control.\n\nI saw plenty of plugins that require a long configuration and continuous adjustment just to update\nthose numbers, if so, better without any plugin then! With this plugin we are required to manage\nonly 2 variables.\n\nInspired from \u003ca href='https://andreborud.com/android-studio-automatic-incremental-gradle-versioning/'\u003eAndroid Studio\nAutomatic Incremental Gradle Versioning\u003c/a\u003e. Customized into library with PreRelease, Auto-Reset and Sub-Modules features.\u003c/p\u003e\n\n\u003e :speech_balloon: Easy to apply, it _works with **any** project type with sub modules too._\n\n## Rules\n###### User values\n**major**: Required, user defined value for breaking changes.\u003cbr\u003e\n**minor**: Required, user defined value for new features, but backwards compatible. If you increase _Major_ version, this value must be coherent(=0).\u003cbr\u003e\n**patch**: Optional, user defined value (or auto-generated value) for backwards compatible bug fixes only.\u003cbr\u003e\n**preRelease**: Optional, user defined value for pre-releases suffix.\u003cbr\u003e\n**incrementOn**: Optional, custom task name to trigger the increase of the version (default: `assembleRelease`, `bundleRelease`, `grabverRelease`).\u003cbr\u003e\n**saveOn**: Optional, custom task name for which you want to save the versioning file (default: `build`, `assembleDebug`, `assembleRelease`, `bundleDebug`, `bundleRelease`, `grabverRelease`, `jar`, `war`, `explodedWar`).\n\n###### Calculation\n**patch** - If not specified by user, increases at each release, but it auto resets back to 0 when _Minor_ or _Major_ version changes or if _preRelease_ is set.\u003cbr\u003e\n**build** - Increases at each build.\u003cbr\u003e\n**code** - Increases at each release.\n\n## Installation\nConfigure plugin management in _settings.gradle_ file: \n``` gradle\npluginManagement {\n    repositories {\n        maven { url \"https://plugins.gradle.org/m2/\" }\n    }\n}\n```\n\nConfigure build script in each _build.gradle_ file:\n``` gradle\nplugins {\n    id \"eu.davidea.grabver\" version \"2.0.3\"\n}\n```\n\n## Usage\n### 1. Version configuration\nApply the plugin in the _module_ you desire, it will create a `version.properties` file under that module!\n``` gradle\nplugins {\n    ...\n    id 'eu.davidea.grabver'\n}\n\nversioning {\n    // Required (number)\n    major 1\n    minor 0\n    // Optional, force custom patch (number)\n    patch 7\n    // Optional (any string)\n    preRelease \"RC1\"\n    // Optional, custom task name to trigger the increase of the version\n    incrementOn \"\u003ctask-name\u003e\"\n    // Optional, custom task name for which you want to save the versioning file\n    saveOn \"\u003ctask-name\u003e\"\n}\n```\n\u003e :speech_balloon: **Note:** The file `version.properties` is auto-generated, but once it's created, you can modify its content\nas of your convenience. Just remember to add it to your Version Control System (from time to time).\n\n### 2. Grab your new version\n``` gradle \nversioning.major\nversioning.minor\nversioning.patch\nversioning.build\nversioning.preRelease\nversioning.code        // needed for all Android projects\nversioning.name        // output: \"major.minor.patch[-preRelease]\"\nversioning.fullName    // output: \"major.minor.patch[-preRelease] #buildNr built on yyyy.MM.dd\"\nversioning.builtOn     // output: \" built on yyyy.MM.dd\"\nversioning.date        // or versioning.getDate([format]) - default \"yyyy.MM.dd\"\n\n// Example: grab the version name\nversion = versioning.name\n```\n\u003e :warning: **Note:** To trigger the evaluation, user must grab one of the above attribute!\n\n### 3. Run it\n- Via command line:\n```\n/**\n * To increment build number only:\n * - Code and Patch remain unchanged\n */\ngradle [build | jar | war | explodedWar | assembleDebug | bundleDebug]\n\n/**\n * To increment build, patch and code:\n * Code and Patch are incremented because of releases:\n * - Code is incremented if exists a release task.\n *   Example: \"bundleRelease\", \"grabverRelease\", \":module:assembleRelease\"\n * - But Patch may be resetted if Major or Minor is changed or if preRelease is set\n */\ngradle [assembleRelease | bundleRelease | grabverRelease]\n```\n- In Android Studio:\n  - via menu _build \u003e Build Bundle / APK_ (bundleDebug | assembleDebug)\n  - via menu _build \u003e Generate Signed Bundle / APK_ (bundleRelease | assembleRelease).\n  - by _running the App_ (assembleDebug | assembleRelease, depending by the build variant).\n\nFrom [version 2](https://github.com/davideas/GrabVer/releases/tag/2.0.0), the plugin evaluates the run tasks\nin silent mode to automatically skip the new version evaluation and to not print unnecessary logs _if_ no save task\nwas detected. A single warning line is however produced.\u003cbr\u003e\nSingle tasks performed such as _clean, test, flyway_ and **all** third parties invented plugin\ntasks out there will not trigger the versioning evaluation. Example:\n\n|Command|Outcome|\n|---|---|\n|`gradle clean test`|Evaluation skipped|\n|`gradle javadoc`|Evaluation skipped|\n|`gradle flywayClean`|Evaluation skipped|\n|`gradle clean build`|Evaluation triggered and new values saved|\n|`gradle clean war grabverRelease`|Evaluation triggered, versioning increased and new values saved|\n\n# Contributions\nEverybody is welcome to improve existing solution.\n\n\u003e :speech_balloon: **Note:** Unit tests work fine if you open the project with IntelliJ Idea, while with Android Studio\nthey don't. Alternatively, you can simulate a real build script by running `gradle install`\nand `gradle -b build-test.gradle [grabverRelease]` OR testing with modules `gradle build [grabverRelease]`.\n\n# License\n\n    Copyright 2017-2024 Davidea Solutions Sprl\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideas%2Fgrabver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavideas%2Fgrabver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideas%2Fgrabver/lists"}