gradle-git-version icon indicating copy to clipboard operation
gradle-git-version copied to clipboard

Gradle git is failing the configuration-cache

Open credmond-git opened this issue 1 year ago • 1 comments

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.

  • What went wrong: Configuration cache problems found in this build.

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

  • Plugin 'git-version-conventions': external process started 'git branch --show-current' See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
  • Plugin 'git-version-conventions': external process started 'git describe --tags --always --first-parent --abbrev=7 --match=* HEAD' See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
  • Plugin 'git-version-conventions': external process started 'git rev-parse HEAD' See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
  • Plugin 'git-version-conventions': external process started 'git status --porcelain' See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes
  • Plugin 'git-version-conventions': external process started 'git version' See https://docs.gradle.org/8.8/userguide/configuration_cache.html#config_cache:requirements:external_processes

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.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.

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

credmond-git avatar Jul 08 '24 21:07 credmond-git

duplicate of #713

xenoterracide avatar Oct 25 '24 15:10 xenoterracide