palantir / gradle-git-version

a Gradle plugin that uses `git describe` to produce a version string.
Apache License 2.0
365 stars 76 forks source link

Gradle git is failing the configuration-cache #816

Open credmond-git opened 2 weeks ago

credmond-git commented 2 weeks ago

What happened?

PS D:\dev\audit> ./gradlew --configuration-cache help
Picked up JAVA_TOOL_OPTIONS: -Dlog4j.formatMsgNoLookups=true
Calculating task graph as no cached configuration is available for tasks: help
Type-safe project accessors is an incubating feature. Project accessors enabled, but root project name not explicitly set for 'buildSrc'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching.

Configure project : Git Build Information
last tag: v0.2X.0 version: v0.2X.0-6-XXXXXXXdirty gitHash: XXXXXXX isCleanTag: false branchName: feat/XXXXXXXX

Task :help

Welcome to Gradle 8.8.

To run a build, run gradlew ...

To see a list of available tasks, run gradlew tasks

To see more detail about a task, run gradlew help --task

To see a list of command-line options, run gradlew --help

For more detail on using Gradle, see https://docs.gradle.org/8.8/userguide/command_line_interface.html

For troubleshooting, visit https://help.gradle.org

FAILURE: Build failed with an exception.

12 problems were found storing the configuration cache, 5 of which seem unique.

See the complete report at file:///D:/dev/audit/build/reports/configuration-cache/9342athxdaeem8n46eeh249m6/cnfhvzi1n5rzefp1th071mava/configuration-cache-report.html

Starting an external process 'git version' during configuration time is unsupported. Starting an external process 'git describe --tags --always --first-parent --abbrev=7 --match=* HEAD' during configuration time is unsupported. Starting an external process 'git status --porcelain' during configuration time is unsupported. Starting an external process 'git rev-parse HEAD' during configuration time is unsupported. Starting an external process 'git branch --show-current' during configuration time is unsupported.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 16s 11 actionable tasks: 2 executed, 9 up-to-date Configuration cache entry discarded with 12 problems.

To get the git information we use

val versionDetails: groovy.lang.Closure<VersionDetails> by extra
        val details = versionDetails()

        println("Git Build Information")
        println("last tag: ${details.lastTag}")
        println("version: ${details.version}")
        println("gitHash: ${details.gitHash}")
        println("isCleanTag: ${details.isCleanTag}")
        println("branchName: ${details.branchName}")

What did you want to happen?

Gradle Git properly supports the new configuration cache features.

See possible solutions in this thread https://discuss.gradle.org/t/using-jgit-with-gradle-configuration-cache/45410/8