Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotless Gradle Plugin fails Gradle 8.1 with configuration cache enabled #1644

Closed
BraisGabin opened this issue Mar 29, 2023 · 3 comments
Closed
Labels

Comments

@BraisGabin
Copy link

Spotless Gradle Plugin 6.17.0 (it also happens with 6.11.0) makes the configuration cache fail on Gradle 8.1-rc-1. This happens just to have the plugin applied. No need to execute any spotless' task.

On macOS I get 4 errors:

> Starting an external process 'bash --login -c which git' during configuration time is unsupported.
> Starting an external process 'xcode-select -p' during configuration time is unsupported.
> Starting an external process '/usr/bin/git --version' during configuration time is unsupported.
> Starting an external process '/usr/bin/git config --system --show-origin --list -z' during configuration time is unsupported.

On Linux I get 2 errors:

> Starting an external process '/usr/bin/git --version' during configuration time is unsupported.
> Starting an external process '/usr/bin/git config --system --show-origin --list -z' during configuration time is unsupported.

The message error also points to this documentation: https://docs.gradle.org/8.1-rc-1/userguide/configuration_cache.html#config_cache:requirements:external_processes

Here you have the 4 stack traces of those errors (from macOS):

org.gradle.api.InvalidUserCodeException: Starting an external process '/usr/bin/git --version' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:87)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:509)
	at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:363)
	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 com.diffplug.spotless.extra.GitAttributesLineEndings$RuntimeInit.<init>(GitAttributesLineEndings.java:160)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:93)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:80)
	at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:118)
	at com.diffplug.gradle.spotless.JvmLocalCache$LiveCacheKeyImpl.set(JvmLocalCache.java:60)
	at com.diffplug.gradle.spotless.SpotlessTask.setLineEndingsPolicy(SpotlessTask.java:75)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl_Decorated.setLineEndingsPolicy(Unknown Source)
	at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:825)
	at com.diffplug.gradle.spotless.KotlinExtension.setupTask(KotlinExtension.java:246)
	at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:70)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        ...
org.gradle.api.InvalidUserCodeException: Starting an external process '/usr/bin/git config --system --show-origin --list -z' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:87)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:509)
	at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:363)
	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:1573)
	at org.eclipse.jgit.util.FS.getGitSystemConfig(FS.java:1631)
	at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:106)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RuntimeInit.<init>(GitAttributesLineEndings.java:160)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:93)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:80)
	at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:118)
	at com.diffplug.gradle.spotless.JvmLocalCache$LiveCacheKeyImpl.set(JvmLocalCache.java:60)
	at com.diffplug.gradle.spotless.SpotlessTask.setLineEndingsPolicy(SpotlessTask.java:75)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl_Decorated.setLineEndingsPolicy(Unknown Source)
	at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:825)
	at com.diffplug.gradle.spotless.KotlinExtension.setupTask(KotlinExtension.java:246)
	at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:70)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        ...
org.gradle.api.InvalidUserCodeException: Starting an external process 'bash --login -c which git' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:87)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:509)
	at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:363)
	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_POSIX.discoverGitExe(FS_POSIX.java:150)
	at org.eclipse.jgit.util.FS.discoverGitSystemConfig(FS.java:1526)
	at org.eclipse.jgit.util.FS.getGitSystemConfig(FS.java:1631)
	at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:106)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RuntimeInit.<init>(GitAttributesLineEndings.java:160)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:93)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:80)
	at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:118)
	at com.diffplug.gradle.spotless.JvmLocalCache$LiveCacheKeyImpl.set(JvmLocalCache.java:60)
	at com.diffplug.gradle.spotless.SpotlessTask.setLineEndingsPolicy(SpotlessTask.java:75)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl_Decorated.setLineEndingsPolicy(Unknown Source)
	at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:825)
	at com.diffplug.gradle.spotless.KotlinExtension.setupTask(KotlinExtension.java:246)
	at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:70)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        ...
org.gradle.api.InvalidUserCodeException: Starting an external process 'xcode-select -p' during configuration time is unsupported.
	at org.gradle.configurationcache.initialization.DefaultConfigurationCacheProblemsListener.onExternalProcessStarted(ConfigurationCacheProblemsListener.kt:87)
	at org.gradle.configurationcache.InstrumentedInputAccessListener.externalProcessStarted(InstrumentedInputAccessListener.kt:110)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:501)
	at org.gradle.internal.classpath.Instrumented.externalProcessStarted(Instrumented.java:509)
	at org.gradle.internal.classpath.Instrumented.start(Instrumented.java:363)
	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_POSIX.discoverGitExe(FS_POSIX.java:169)
	at org.eclipse.jgit.util.FS.discoverGitSystemConfig(FS.java:1526)
	at org.eclipse.jgit.util.FS.getGitSystemConfig(FS.java:1631)
	at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:106)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RuntimeInit.<init>(GitAttributesLineEndings.java:160)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:93)
	at com.diffplug.spotless.extra.GitAttributesLineEndings$RelocatablePolicy.calculateState(GitAttributesLineEndings.java:80)
	at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:118)
	at com.diffplug.gradle.spotless.JvmLocalCache$LiveCacheKeyImpl.set(JvmLocalCache.java:60)
	at com.diffplug.gradle.spotless.SpotlessTask.setLineEndingsPolicy(SpotlessTask.java:75)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl_Decorated.setLineEndingsPolicy(Unknown Source)
	at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:825)
	at com.diffplug.gradle.spotless.KotlinExtension.setupTask(KotlinExtension.java:246)
	at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:70)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        ...

I could create a reproducer if needed.

@nedtwigg
Copy link
Member

nedtwigg commented Apr 3, 2023

Thanks for the error report! This is probably going to hit us in a few places

This change in 8.1 seems likely to wreak havoc in the plugin ecosystem, maybe some mitigations will become available...

@BraisGabin
Copy link
Author

There is a workaround for this issue:

spotless {
    // https://github.com/diffplug/spotless/issues/1644
    lineEndings = LineEnding.PLATFORM_NATIVE // or any other except GIT_ATTRIBUTES
}

marcphilipp added a commit to junit-team/testng-engine that referenced this issue Apr 28, 2023
geiralund added a commit to navikt/dp-behandling that referenced this issue May 3, 2023
…/spotless#1644 (comment)

Co-authored-by: Marius Eriksen <marius.eriksen@nav.no>
Co-authored-by: Mona Kjeldsrud <mona.kjeldsrud@nav.no>
torresmi added a commit to torresmi/reductions-android that referenced this issue Jun 10, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 20, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 20, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 21, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 22, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 25, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 26, 2023
chrisbanes added a commit to chrisbanes/tivi that referenced this issue Jul 26, 2023
geiralund added a commit to navikt/dagpenger-events that referenced this issue Aug 17, 2023
geiralund added a commit to navikt/dagpenger-events that referenced this issue Aug 17, 2023
geiralund added a commit to navikt/dagpenger-streams that referenced this issue Aug 18, 2023
@nedtwigg
Copy link
Member

nedtwigg commented Sep 1, 2023

Released in plugin-gradle 6.21.0

geiralund added a commit to navikt/dagpenger-joark-mottak that referenced this issue Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants