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

Incompatible with new Gradle configuration cache #134

Open
magneticflux- opened this issue May 11, 2023 · 5 comments
Open

Incompatible with new Gradle configuration cache #134

magneticflux- opened this issue May 11, 2023 · 5 comments

Comments

@magneticflux-
Copy link

Requirements for tasks to support configuration caching: https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements

Errors logged:

FAILURE: Build failed with an exception.

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

2 problems were found storing the configuration cache.
- Plugin 'org.shipkit.shipkit-auto-version': external process started 'git log --pretty=oneline v0.1.23..HEAD'
  See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Plugin 'org.shipkit.shipkit-auto-version': external process started 'git tag'
  See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:external_processes

In the documentation here, they suggest using providers.exec() to postpone execution until the property is actually needed.

@mockitoguy
Copy link
Contributor

Makes sense. We should look into it. Have you thought about contributing? Thanks for reporting!

@magneticflux-
Copy link
Author

Can I upgrade the minimum Gradle version? providers.exec() is only available since Gradle 7.5.
If sticking on 6.1 is required, I can make a custom ValueSource to replace ProcessRunner and work with Provider<T>s.

Either way, it looks like Gradle APIs (Provider, Project, etc.) are going to have to reach deeper into the code. You commented in AutoVersion.java "Main functionality, should never depend on any of Gradle APIs.", but the only way I see to preserve that is to wrap the entire functionality in a ValueSource, which kinda defeats the purpose of Gradle's state tracking. It's a lightweight git log call right now, but if we want to add some heavy feature later everything will be wrapped together.

If I could do whatever I wanted, I think I would start by making VersionsProvider a ValueSource, making a Provider out of it, and then mapping that with the logic in AutoVersion to get a Provider<String>. Then we can just wire up that to the version property and Gradle should handle the whole data graph and do whatever caching it wants to.

@mockitoguy
Copy link
Contributor

Hey can you summarize version we are compatible / not compatible with? Sorry for late response - if it takes too long for me to respond/figure it out I'll give you write permissions to the repo and green light for making a decision on this.

@mockitoguy
Copy link
Contributor

@magneticflux-, interested in becoming a project member of the Shipkit organization?

@benbitrise
Copy link
Contributor

@mockitoguy @Magneticflux - I've opened a PR for configuration cache support. #187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants