-
Notifications
You must be signed in to change notification settings - Fork 80
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
Also update Gradle wrapper with Java version upgrades #182
Comments
@timtebeek, this is a great idea and one that I've thought of before. Only aspect though, which could also remove it as a good first issue for now, would be that if the project were using deprecated Gradle features and these recipes were applied it could leave the project in a broken state. Given the OpenRewrite rule of "Do no harm", I think we would have to wait until at least the breaking changes per Gradle major version migration recipes have also been implemented. |
Thanks for pointing that out @shanman190 ; that indeed blocks this one until the Gradle version migration recipes catch up. I'm thinking if there's anything we can do until then as a partial solution; Would you think it'd be helpful to detect and upgrade within the 7.x range for instance? I'm not expecting breaking changes there, and it would get those on 7.0-2 unstuck in moving up to 17, 18, 19, ... It might mean we need to split the Gradle version migrations similar to what we already do with the Spring version migrations: daisy chain them together and properly guard to only update within a range for certain recipes, which we then use here for now. |
@timtebeek, we could do half steps in terms of upgrading within a major line, but that also requires applicability tests to work properly (predicated on openrewrite/rewrite#2746). In total what comes to mind when talking about an upgrade to JDK 17 for Gradle as an example:
To localize this a bit if the above issue were resolved, then you could easily do a half step of upgrading within the major line. So for folks on 7.x already, they'd get benefits immediately. |
@timtebeek, I was thinking about this a little bit more and there's an interesting part of this. If the project is using Gradle 6.7+ AND using JVM toolchains, then just updating the toolchain to JDK 17 is enough (read: wrapper update is not required). However, if the project is using |
That's an interesting take indeed; could spare us some of the pain of migrating between Gradle versions if we provide a recipe to switch people over to toolchains, or merely upgrade the toolchain where applicable. Would you say that warrants a separate recipe, perhaps split off from the one that upgrades source/target compatibility? Eventually I imagine we might still want to upgrade the wrapper, but that would need to also handle deprecations, which would be more work before we can confidently run that unsupervised. |
We have an existing recipe to upgrade Gradle wrappers; When upgrading applications to Java 11, 17 and beyond, we should also upgrade the Gradle wrapper to the corresponding versions as per the version compatibility matrix.
We should
rewrite-gradle
org.openrewrite.gradle.UpdateGradleWrapper
in for instance src/main/resources/META-INF/rewrite/java-version-17.ymlversion
parameter according tot he above tableThe text was updated successfully, but these errors were encountered: