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

Configuration cache issue with use of uname -a on macOS #211

Closed
msridhar opened this issue Aug 20, 2023 · 8 comments
Closed

Configuration cache issue with use of uname -a on macOS #211

msridhar opened this issue Aug 20, 2023 · 8 comments
Labels

Comments

@msridhar
Copy link

I see a configuration cache problem in particular circumstances when using this plugin on macOS. Here is my version info:

------------------------------------------------------------
Gradle 8.3
------------------------------------------------------------

Build time:   2023-08-17 07:06:47 UTC
Revision:     8afbf24b469158b714b36e84c6f4d4976c86fcd5

Kotlin:       1.9.0
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.8 (Azul Systems, Inc. 17.0.8+7-LTS)
OS:           Mac OS X 13.5 aarch64

I'm using version 3.42.2 of the plugin. To reproduce, clone https://github.com/wala/WALA, and then run ./gradlew clean compileJava compileTestJava --no-build-cache --no-daemon. I get the following error:

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

1 problem was found storing the configuration cache.
- Plugin 'com.diffplug.configuration-cache-for-platform-specific-build': external process started 'uname -a'
  See https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:external_processes

See the complete report at file:///Users/msridhar/git-repos/WALA/build/reports/configuration-cache/4qxf7tzsgios90i91fxmtohav/a10rhbrh9u5tku1v9bqi75yce/configuration-cache-report.html
> Starting an external process 'uname -a' during configuration time is unsupported.

I see the same error on JDK 11 and JDK 17. I'm attaching the configuration cache report from JDK 17.

Gradle Configuration Cache.pdf

Please let me know I can provide any other information.

@msridhar
Copy link
Author

Possibly related to #203, but now I believe we already have the com.diffplug.configuration-cache-for-platform-specific-build plugin set up correctly in our settings.gradle.

@msridhar
Copy link
Author

It looks like this code is relevant, similar to #203 (in fact this issue may just be a duplicate and possibly #203 was closed erroneously):

https://github.com/diffplug/durian-swt/blob/6adaf31d894be65fadcafaa1d8610c05c6561942/durian-swt.os/src/main/java/com/diffplug/common/swt/os/OS.java#L135-L136

Looks like this issue is specific to MacOS and detecting whether the chip is ARM or x86.

@msridhar
Copy link
Author

I attempted a fix for this in diffplug/durian-swt#24.

@nedtwigg
Copy link
Member

Thanks for the PR! I posted my concerns there. If my concerns are incorrect, then this is easy to fix. If my concern is correct, I think we can fix it by using uname within this: https://github.com/diffplug/goomph/blob/main/src/main/java/com/diffplug/gradle/swt/PlatformSpecificBuildPlugin.java

@msridhar
Copy link
Author

Hi @nedtwigg as I noted on the PR I think your concern is correct. As to changing PlatformSpecificBuildPlugin instead, I'm not exactly sure how that would work; I think we'd need to make a change also in durian-swt? In any case, if you'd like me to make a PR, it will be a few days before I can look again. Again thanks for the feedback!

@nedtwigg
Copy link
Member

According to the docs here, this will work if it was run inside the plugin's apply block.

def gitVersion = providers.exec {
    commandLine("git", "--version")
}.standardOutput.asText.get()

Seems like something along the lines of

OS.detectPlatform(
  systemProp -> settings.getProviders().systemProperty(systemProp).forUseAtConfigurationTime().get(),
  envVar -> settings.getProviders().environmentVariable(envVar).forUseAtConfigurationTime().get(),
  (Function<List<String>, String> command executor) -> { args ->
    settings.getProviders().exec {
       commandLine(args)
    }.standardOutput.asText.get()
  }
);

@msridhar
Copy link
Author

msridhar commented Dec 8, 2023

Thanks for this fix!! I confirmed on the WALA project that this fixes the configuration cache problem we were seeing on an M1 Mac.

msridhar added a commit to wala/WALA that referenced this issue Dec 8, 2023
Fixes #1278, as a fix for diffplug/goomph#211
has landed in this release. 🎉
@nedtwigg
Copy link
Member

nedtwigg commented Dec 8, 2023

Fixed in 3.44.0.

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