-
Notifications
You must be signed in to change notification settings - Fork 41
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 the configuration cache #227
Comments
Let me know if or when this issue has been assigned to me, and I'd be more than happy to look into a fix. 😄 |
Oh, I've just seen that the contribution guidelines say I can open a draft PR anytime I want, so I'll proceed when I have something to show. |
Much appreciated @jbduncan , and good seeing you here. I've assigned the issue all the same, and look forward to your PR! |
Just jumping in here real quick to save some time, but in order to support configuration cache will require bumping the base line Gradle target away from 4.0. The reason for this is a lot of the infrastructure that is required for compatibility with configuration cache isn't available with this base line target yet. If we're ok with changing the baseline version to something newer, then that opens up possibilities for a lot of improvements. |
@shanman190 Thanks for your insight. I'll wait until I've received the go ahead to bump the min Gradle version to a more suitable version, then. |
Actually I've done some research and found out the minimum version needed to run the configuration cache is Gradle 6.6. I'll assume this is fine and proceed with my draft PR accordingly. |
Interestingly, on bumping the internal min Gradle version to 6.6, I'm now seeing https://stackoverflow.com/questions/76897459/how-can-i-make-gradle-pick-the-right-guava-variant, which I see @timtebeek responded to, but I don't think an issue has been raised yet. I'm just trying to figure out now how to make rewrite-gradle-plugin use the JRE version of Guava when dynamically importing Checkstyle. Any insights would be appreciated. |
The easiest solution is to require Gradle 6.8.3+, because we already import the right "attribute" in |
Just looking through the specific errors that were reported here, I think the lowest achievable version that would also support configuration cache would be Gradle 4.3. At Gradle 4.3 is when the Before anything were to be chosen officially, I'd like to see what @sambsnyd and @jkschneider's thoughts are specifically. Historically, the Gradle 4.0 requirement was set so that very old codebases could have OpenRewrite operate over them. |
If we do proceed, |
Hi all; we discussed this internally (sorry that took a while) and have decided to got with Gradle 4.10+ from now on. So any improvements you see that would be unlocked through that are welcome, either as suggestions or a PR such as #228. Much appreciate your involvement here and pushing us forward. |
Supporting different gradle versions is discussed at #256 (comment). |
@timtebeek Thank you very much for the latest news! I'll update #228 to use Gradle 4.10, then. |
FWIW, I've been affected by this issue today and would benefit from the fix. Thanks for reporting and looking into it, @jbduncan. |
* Add a few failing tests * Bump minimum Gradle version to 6.8.3 to allow for configuration cache compatibility and to avoid bugs with dependency resolution on Gradle 6.6, which is the first version that the config cache is introduced * Remove ResolveRewriteDependenciesTask and fix one config cache problem w/ RewriteDryRunTask * Fix another config cache problem w/ RewriteDryRunTask * More work done; tests are still failing... * Delete redundant 'resolve dependencies' task * Use notCompatibleWithConfigurationCache on Gradle 7.4+ * Remove invalid comment * Cleanup * Extract common config-cache test into base test class * Cleanup after merge conflict resolution * Cleanup after merge conflict resolution * Add `rewrite-java-21` to `knownRewriteDependencies` --------- Co-authored-by: Tim te Beek <[email protected]>
The associated PR has been merged, so I'm marking this issue as resolved. |
I'm using rewrite-gradle-plugin's
rewriteDryRun
in my project as a task that gets run everytime./gradle check
is run, but when I enable the configuration cache, it prints some errors and fails.What version of OpenRewrite are you using?
I am using
No recipes are needed to reproduce the problem.
How are you running OpenRewrite?
I am using the Gradle plugin, and my project is a single module project.
The problem can be reproduced with just this build file.
build.gradle.kts
But my full project can be found at https://github.com/jbduncan/guava-graph-utils.
What is the smallest, simplest way to reproduce the problem?
Run the above
build.gradle.kts
file with Gradle 8.3 on Java 17, with the command./gradlew rewriteDryRun --configuration-cache
.What did you expect to see?
The dry run should succeed (albeit with no code changes since there is neither any source code nor any recipes).
What did you see instead?
I get the following logs:
Error logs
What is the full stack trace of any errors you encountered?
Running
./gradlew rewriteDryRun --configuration-cache --stacktrace
I get:Full stacktrace logs
Are you interested in contributing a fix to OpenRewrite?
I'd love to! I have experience maintaining the Spotless Gradle plugin, but I've never made plugins configuration-cache-compatible before. The Gradle website has a guide on avoiding incompatible Gradle-specific types like
Project
, butTask
specifically isn't mentioned, so any insights on how to avoid it would be appreciated.The text was updated successfully, but these errors were encountered: