-
Notifications
You must be signed in to change notification settings - Fork 428
Added test showing UpgradeDependencyVersion does not upgrade buildscript.ext {}
when using dependencies.gradle
#5547
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
I'm not sure if this test case captures a valid Gradle build. For some reason I think the buildscript.ext is treated separately from project.ext without overlap. Secondarily, variable substitution was intentionally limited to the current build descriptor that contains a dependency that utilizes the variable (effectively enforcing scoping rules) and gradle.properties because otherwise we have no linkage to knowing that we're updating the correct variable or just some other random one that just so happens to have the same name. |
rewrite-gradle/src/main/java/org/openrewrite/gradle/Assertions.java
Outdated
Show resolved
Hide resolved
rewrite-gradle/src/test/java/org/openrewrite/gradle/UpgradeDependencyVersionTest.java
Outdated
Show resolved
Hide resolved
rewrite-gradle/src/test/java/org/openrewrite/gradle/UpgradeDependencyVersionTest.java
Outdated
Show resolved
Hide resolved
I'm not that big of a gradle expert, but what I found so far is that variables declared in I could expand on the solution, by actually keeping track of files where dependencies are declared in the scanner (so I know |
Ok, so researched this a little bit more.
So any of these properties are going to be project specific and the imported standalone script would have it's version be directly dependent upon the current project's state of their extension. So as an illustration: settings.gradle
projectA/build.gradle
projectB/build.gradle
The above project is valid, but each project would include a different version of Guava because the extra properties are evaluated individually within the context of the script application. This is one of the challenges with respect to global dataflow analysis in terms of Gradle scripts. |
What's changed?
buildscript.ext {}
when using dependencies.gradleWhat's your motivation?