{"id":43965095,"url":"https://github.com/andreabrighi/gradle-git-sensitive-semantic-versioning-plugin-for-android","last_synced_at":"2026-06-08T04:00:46.276Z","repository":{"id":156124188,"uuid":"624518646","full_name":"AndreaBrighi/Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android","owner":"AndreaBrighi","description":"A Gradle plugin that forces semantic versioning in an Android project (version name and version code) and relies on git to detect the project state, based on Git-Sensitive Semantic Versioning Plugin by Danilo Pianini .","archived":false,"fork":false,"pushed_at":"2026-06-06T12:39:01.000Z","size":1506,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-06T14:17:01.717Z","etag":null,"topics":["android","git","gradle","gradle-plugin","versioning"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndreaBrighi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-06T16:42:59.000Z","updated_at":"2026-06-06T12:38:20.000Z","dependencies_parsed_at":"2026-04-25T11:02:32.541Z","dependency_job_id":null,"html_url":"https://github.com/AndreaBrighi/Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/AndreaBrighi/Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreaBrighi%2FGradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreaBrighi%2FGradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreaBrighi%2FGradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreaBrighi%2FGradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndreaBrighi","download_url":"https://codeload.github.com/AndreaBrighi/Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreaBrighi%2FGradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34047266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","git","gradle","gradle-plugin","versioning"],"created_at":"2026-02-07T06:14:38.490Z","updated_at":"2026-06-08T04:00:46.254Z","avatar_url":"https://github.com/AndreaBrighi.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git sensitive Semantic Versioning (SemVer) Gradle Plugin for Android\n\nA Gradle plugin that forces semantic versioning in an Android project (version name and version code) and relies on git to detect\nthe project state, based on  [Git-Sensitive Semantic Versioning Plugin by Danilo Pianini](https://github.com/DanySK/git-sensitive-semantic-versioning-gradle-plugin) .\n\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=ncloc)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=project=AndreaBrighi_Gradle-Git-Sensitive-Semantic-Versioning-Plugin-for-Android)\n\n## Rationale\n\n[Semantic Versioning](https://semver.org/) introduces a way to meaningfully version software.\nAt the same time, git carries the project history with it.\nIt sounds rather reasonable to mix them together, and have the project react to the git status.\n\nThis plugin assumes you use git tags to mark releases, by tagging your project with tag names such as `0.1.2`.\nIt then uses git to compute the version, in terms of both git hash and distance from the latest tag.\n\nThe plugin generates the following:\n\n* \"Archeo\" versions for the development before initializing git, in the form of `0.1.0-archeo+time`\n* \"Pre-development\" versions for the development before marking the first release, in the form of `0.1.0-dev+hash`\n* \"Stable\" versions if a tag is present, in the form `0.1.0`\n* \"Development\" versions for changes over a tag, in the form `0.1.1-dev01-hash`, with the number after `dev` counting the distance in commits since the last tag.\n\n## Usage\n\n### Importing the plugin\n\nIn your `build.gradle.kts` file of the app module add the following:\n\n```kotlin\nplugins {\n    id(\"io.github.andreabrighi.android-git-sensitive-semantic-versioning-gradle-plugin\") version \"1.0.2\"\n}\n// Rest of your buildscript\n\n...\nandroidGitSemVer {\n    // Your configuration\n}\n...\n    android {\n        defaultConfig {\n            ...\n            versionCode = androidGitSemVer.computeVersionCode()\n            versionName = androidGitSemVer.computeVersion()\n        }\n    }\n```\n\n### Plugin options\n\n```kotlin\nandroidGitSemVer {\n    minimumVersion.set(\"0.1.0\")\n    developmentIdentifier.set(\"dev\")\n    noTagIdentifier.set(\"archeo\")\n    fullHash.set(false) // set to true if you want to use the full git hash\n    maxVersionLength.set(Int.MAX_VALUE) // Useful to limit the maximum version length, e.g. Gradle Plugins have a limit on 20\n    developmentCounterLength.set(2) // How many digits after `dev`\n    enforceSemanticVersioning.set(true) // Whether the plugin should stop if the resulting version is not a valid SemVer, or just warn\n    // The separator for the pre-release block.\n    // Changing it to something else than \"+\" may result in non-SemVer compatible versions\n    preReleaseSeparator.set(\"-\")\n    // The separator for the build metadata block.\n    // Some systems (notably, the Gradle plugin portal) do not support versions with a \"+\" symbol.\n    // In these cases, changing it to \"-\" is appropriate.\n    buildMetadataSeparator.set(\"+\")\n    distanceCounterRadix.set(36) // The radix for the commit-distance counter. Must be in the 2-36 range.\n    // A prefix on tags that should be ignored when computing the Semantic Version.\n    // Many project are versioned with tags named \"vX.Y.Z\", de-facto building valid SemVer versions but for the leading \"v\".\n    // If it is the case for some project, setting this property to \"v\" would make these tags readable as SemVer tags.\n    versionPrefix.set(\"\")\n    // This reproduces the behavior of the plugin at version 0.x.y: ignores non-annotated (lightweight) tags.\n    excludeLightweightTags()\n    // Compute the next upgrade type (major/minor/patch) based on commit messages; defaults to patch regardless of the commits.\n    commitNameBasedUpdateStrategy { UpdateType.PATCH }\n}\n```\n\n### Code Version computation\n\nThe plugin computes the version code by using two algorithms:\n    - The first one is based on the number of commits in the current branch (default).\n    - The second one is based on the version name.\n\nTo use the second algorithm:\n\n```kotlin\nandroidGitSemVer {\n    incrementalCode.set(false) // Whether the version code should be use semantic versioning\n    versionCodeMajorDigits.set(3) // How many digits for the major version (default 3)\n    versionCodeMinorDigits.set(3) // How many digits for the minor version (default 3)\n    versionCodePatchDigits.set(3) // How many digits for the patch version (default 3)\n}\n```\n\n### Manually forcing the version computation early\n\nThe plugin sets the project version by scheduling a call to the `assignGitSemanticVersion()` using `project.afterEvaluate`.\nThis should be fine for most use cases, but you might need the version of the project to be set early in the configuration phase.\nIf so, you can manually call `assignGitSemanticVersion()` from within the plugin configuration block, *after* all options have been configured\n(if any configuration was performed):\n\n```kotlin\nandroidGitSemVer {\n    // Your configuration\n    assignGitSemanticVersion()\n}\n```\n\nInside the configuration block is also available the `computeVersion()` is also available to recompute (but do not set)\nthe version.\n\n### Manually force the version\n\nThe plugin allows to manually set the version via a gradle property that, if present, will be used as the version of the project.\nBy default, the property name is `forceVersion`, but you can change the property name by setting the `forceVersionPropertyName` property of the plugin with a custom name.\n\n`./gradlew -PforceVersion=1.2.3 \u003ctask list\u003e` will result in the project version being set to `1.2.3`.\n\nIf a custom property name is used, the plugin will look for the property with the given name:\n\n```kotlin\nandroidGitSemVer {\n    forceVersionPropertyName.set(\"myCustomPropertyVersion\")\n}\n```\n\n`./gradlew -PmyCustomPropertyVersion=1.2.3 \u003ctask list\u003e` will result in the project version being set to `1.2.3`.\n\n### Using conventional commits?\n\nThis plugin can be configured to use the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to determine the next version\nthrough another plugin.\nVisit the [conventional commits extension for git-sensitive-semantic-versioning-gradle-plugin](https://github.com/AndreaBrighi/conventional-commit-strategy-for-git-sensitive-semantic-versioning-gradle-plugin) to learn more.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabrighi%2Fgradle-git-sensitive-semantic-versioning-plugin-for-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreabrighi%2Fgradle-git-sensitive-semantic-versioning-plugin-for-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreabrighi%2Fgradle-git-sensitive-semantic-versioning-plugin-for-android/lists"}