ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
184 stars 28 forks source link

[Feature request] Support Gradle configuration cache #202

Open runningcode opened 3 weeks ago

runningcode commented 3 weeks ago

This plugin does not support the Gradle configuration cache.

Here is an example of calling external processes (like git) in a Configuration Cache compatible way: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:external_processes

To reproduce, checkout https://github.com/home-assistant/android and run ./gradlew assembleDebug --configuration-cache Using Gradle 8.8 and 0.18.3 of the reckon settings plugin.

This is the stacktrace:

org.gradle.api.InvalidUserCodeException: Starting an external process '/opt/homebrew/bin/git --version' during configuration time is unsupported.
    at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:319)
    at org.eclipse.jgit.util.FS.readPipe(FS.java:1383)
    at org.eclipse.jgit.util.FS.readPipe(FS.java:1345)
    at org.eclipse.jgit.util.FS.discoverGitSystemConfig(FS.java:1534)
    at org.eclipse.jgit.util.FS.getGitSystemConfig(FS.java:1631)
    at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:106)
    at org.eclipse.jgit.util.SystemReader.getSystemConfig(SystemReader.java:386)
    at org.eclipse.jgit.util.SystemReader.getUserConfig(SystemReader.java:334)
    at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:162)
    at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:55)
    at org.ajoberstar.reckon.gradle.ReckonExtension.openRepo(ReckonExtension.java:195)
    at org.ajoberstar.reckon.gradle.ReckonExtension.reckonVersion(ReckonExtension.java:170)
    at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:100)
    at org.ajoberstar.reckon.gradle.ReckonSettingsPlugin$DelayedVersion.toString(ReckonSettingsPlugin.java:75)
    at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.applyPluginsTo(Interpreter.kt:385)
    at Program.execute(Unknown Source)
    at java.base/java.lang.Thread.run(Thread.java:1583)

Below is a screenshot of the configuration cache report.

image