{"id":20208854,"url":"https://github.com/palantir/gradle-git-version","last_synced_at":"2025-10-24T12:22:50.640Z","repository":{"id":3139461,"uuid":"42682653","full_name":"palantir/gradle-git-version","owner":"palantir","description":"a Gradle plugin that uses `git describe` to produce a version string.","archived":false,"fork":false,"pushed_at":"2025-05-14T20:24:19.000Z","size":1718,"stargazers_count":400,"open_issues_count":55,"forks_count":76,"subscribers_count":271,"default_branch":"develop","last_synced_at":"2025-05-14T21:29:24.079Z","etag":null,"topics":["octo-correct-managed"],"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/palantir.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog/0.12.1/pr-152.v2.yml","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}},"created_at":"2015-09-17T21:21:50.000Z","updated_at":"2025-05-14T20:24:22.000Z","dependencies_parsed_at":"2023-10-20T08:35:58.770Z","dependency_job_id":"efb903ff-339c-467d-bb9c-0e951851e426","html_url":"https://github.com/palantir/gradle-git-version","commit_stats":{"total_commits":564,"total_committers":33,"mean_commits":17.09090909090909,"dds":"0.15602836879432624","last_synced_commit":"bfe9f81ad5bdd396a1948e090d3eb3b99252dfb7"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fgradle-git-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fgradle-git-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fgradle-git-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palantir%2Fgradle-git-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palantir","download_url":"https://codeload.github.com/palantir/gradle-git-version/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319718,"owners_count":22051072,"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":["octo-correct-managed"],"created_at":"2024-11-14T05:37:32.961Z","updated_at":"2025-10-24T12:22:50.635Z","avatar_url":"https://github.com/palantir.png","language":"Groovy","funding_links":[],"categories":["\u003ca name=\"Groovy\"\u003e\u003c/a\u003eGroovy"],"sub_categories":[],"readme":"\u003cp align=\"right\"\u003e\n\u003ca href=\"https://autorelease.general.dmz.palantir.tech/palantir/gradle-git-version\"\u003e\u003cimg src=\"https://img.shields.io/badge/Perform%20an-Autorelease-success.svg\" alt=\"Autorelease\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nGit-Version Gradle Plugin\n=========================\n[![Build Status](https://circleci.com/gh/palantir/gradle-git-version.svg?style=shield)](https://circleci.com/gh/palantir/gradle-git-version)\n[![Gradle Plugins Release](https://img.shields.io/github/release/palantir/gradle-git-version.svg)](https://plugins.gradle.org/plugin/com.palantir.git-version)\n\nAs of gradle-git-version 4.0, minimum supported JDK version is JDK 17 - in preparation for Gradle 9.0.\n\nWhen applied, Git-Version adds two methods to the target project.\n\nThe first, called `gitVersion()`, mimics `git describe --tags --always --first-parent` to determine a version string.\nIt behaves exactly as `git describe --tags --always --first-parent` method behaves, except that when the repository is\nin a dirty state, appends `.dirty` to the version string.\n\nThe second, called `versionDetails()`, returns an object containing the specific details of the version string:\nthe tag name, the commit count since the tag, the current commit hash of HEAD, and an optional branch name of HEAD.\n\nUsage\n-----\nApply the plugin using standard Gradle convention:\n\n**Groovy**\n```groovy\nplugins {\n    id 'com.palantir.git-version' version '\u003ccurrent version\u003e'\n}\n```\n\n**Kotlin**\n```kotlin\nplugins {\n    id(\"com.palantir.git-version\") version \"\u003ccurrent version\u003e\"\n}\n```\n\nSet the version of a project by calling:\n\n**Groovy**\n```groovy\nversion gitVersion()\n```\n\n**Kotlin**\n```kotlin\nval gitVersion: groovy.lang.Closure\u003cString\u003e by extra\nversion = gitVersion()\n```\n\nYou can get an object containing more detailed information by calling:\n\n**Groovy**\n```groovy\ndef details = versionDetails()\ndetails.lastTag\ndetails.commitDistance\ndetails.gitHash\ndetails.gitHashFull // full 40-character Git commit hash\ndetails.branchName // is null if the repository in detached HEAD mode\ndetails.isCleanTag\n```\n\n**Kotlin**\n```kotlin\nval versionDetails: groovy.lang.Closure\u003ccom.palantir.gradle.gitversion.VersionDetails\u003e by extra\nval details = versionDetails()\ndetails.lastTag\ndetails.commitDistance\ndetails.gitHash\ndetails.gitHashFull // full 40-character Git commit hash\ndetails.branchName // is null if the repository in detached HEAD mode\ndetails.isCleanTag\n```\n\nYou can optionally search a subset of tags with `prefix`. Example when the tag is my-product@2.15.0:\n\n**Groovy**\n```groovy\ngitVersion(prefix:'my-product@') // -\u003e 2.15.0\n```\n\n**Kotlin**\n```kotlin\nval gitVersion: groovy.lang.Closure\u003cString\u003e by extra\ngitVersion(mapOf(\"prefix\" to \"my-product@\")) // -\u003e 2.15.0\n```\n\nValid prefixes are defined by the regex `[/@]?([A-Za-z0-9]+[/@-])+`.\n```\n/Abc/\nAbc@\nfoo-bar@\nfoo/bar-v2@\n```\n\nTasks\n-----\nThis plugin adds a `printVersion` task, which will echo the project's configured version\nto standard-out.\n\n\n☑️ Configuration cache\n---\nExternal process calls to `git` in this plugin are compatible with Gradle's [Configuration Cache](https://docs.gradle.org/current/userguide/configuration_cache.html).\n\nSince we're using Configuration Cache compatible APIs, we leverage Gradle's ability to reuse outputs of `git` commands upon successive invocations.\n\n`VersionDetails` caches calls to `git` with Gradle's [`Provider\u003cExecOutput\u003e`](https://docs.gradle.org/current/javadoc/org/gradle/process/ExecOutput.html#getResult()). External calls can be  expensive, especially if called repeatedly across multiple projects. Caching prevents running the same `git` command more than once in a single build. \n\n\u003e [!WARNING]\n\u003e If the state of the git repo changes within a single gradle session (e.g. a task in the build does `git commit`), `VersionDetails` might reflect the outdated state of your repo.\n\nHowever, changes to the state of your repo between gradle builds i.e. two runs of gradle...\n```bash\n./gradlew check\ngit commit -m \"new commit\"\n./gradlew check\n```\n\n...are not affected by this, as the cache is scoped to individual `VersionDetails` instances. \n\n\nLicense\n-------\nThis plugin is made available under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalantir%2Fgradle-git-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalantir%2Fgradle-git-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalantir%2Fgradle-git-version/lists"}