-
Notifications
You must be signed in to change notification settings - Fork 426
Gradle - Add tests for update in dependencyManagement #5304
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Thomas Vitale <[email protected]>
Signed-off-by: Thomas Vitale <[email protected]>
|
||
@Issue("https://github.com/openrewrite/rewrite/issues/5300") | ||
@Test | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignored since this is currently failing:
Recipe was expected to make a change but made no changes.
java.lang.AssertionError: Recipe was expected to make a change but made no changes.
at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:119)
at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:98)
at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
at org.openrewrite.Recipe.run(Recipe.java:438)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:377)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:130)
at org.openrewrite.gradle.UpgradeDependencyVersionTest.makeChangesInDependencyManagement(UpgradeDependencyVersionTest.java:436)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also probably duplicate this test with a Gradle Kotlin DSL variation as well.
Thanks for the start here @ThomasVitale ! I'm going to ask if @shanman190 has some guiding hints here for whether we want to make these changes as part of this recipe, and if that should be in a separate visitor perhaps. He's our friendly community authority on all things Gradle. 🧙🏻♂️ |
Perfect, thank you so much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is probably best as Tim suggested to do this as a separate dedicated visitor given that this section is 1) not type attributed and 2) extremely specific to the Spring Dependency Management plugin.
As you'll see with the other visitors, I would suggest utilizing the JavaIsoVisitor
, then also performing similar updates to handle both Gradle Groovy DSL and Gradle Kotlin DSL both.
If you choose to also handle variable updates -- which it seems likely given the test case you've written here -- then you may end up having to collect the parameter names within the scanning phase of the existing JavaIsoVisitor
. It's also possible to use a separate visitor for this phase as well though, if you feel that it comes out more cleanly.
Some additional notes:
mavenBom
only supports String notationdependency
supports String and Map notations
@@ -394,6 +395,99 @@ implementation platform("com.google.guava:guava:30.1.1-jre") | |||
); | |||
} | |||
|
|||
@Issue("https://github.com/openrewrite/rewrite/issues/5300") | |||
@Test | |||
void doesNotMakeChangesInDependencyManagement() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test feels a bit extraneous to me since it's effectively never going to do anything from a recipe standpoint.
|
||
@Issue("https://github.com/openrewrite/rewrite/issues/5300") | ||
@Test | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also probably duplicate this test with a Gradle Kotlin DSL variation as well.
@shanman190 thanks so much for the inputs. I'll look a bit deeper into the |
What's changed?
What's your motivation?
dependencyManagement
block #5300Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
@timtebeek
Have you considered any alternatives or workarounds?
Yes, workaround considered and explained in #5300, but not feasible in certain scenarios.
Checklist