Skip to content

Update version in the Gradle model#6428

Merged
timtebeek merged 4 commits intoopenrewrite:mainfrom
BoykoAlex:gradle-chang-dep
Jan 2, 2026
Merged

Update version in the Gradle model#6428
timtebeek merged 4 commits intoopenrewrite:mainfrom
BoykoAlex:gradle-chang-dep

Conversation

@BoykoAlex
Copy link
Copy Markdown
Contributor

Update new dependency version in the model

@timtebeek
Copy link
Copy Markdown
Member

Thanks a lot for helping explore these failures to detect duplicates. Taking into account your comment here I'll also tag Shannon and Sam for review.

This helps: #6428
However, I'm somewhat uncomfortable about computing resolvedVersion for every config... wonder if this needed at all. Wonder what would be the argument against keeping one cached resolvedVersion for all configs...

Comment on lines +846 to +847
.containsOnlyOnce("tools.jackson.core:jackson-databind:3")
.doesNotContain("datatype")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context: without the above changes we saw jackson-databind:3 duplicated twice, as both map to the new artifact & version.

@shanman190
Copy link
Copy Markdown
Contributor

So most of the recipes compute the new version during the actual edit itself, then reuses the resolved version to modify all configurations.

Otherwise, the fix seems reasonable.

@BoykoAlex
Copy link
Copy Markdown
Contributor Author

@timtebeek I think this should be okay to go in as is more or less. The AST changes are in visitMethodInvocation etc hence we cannot update the GradleProject model right away. Changes can be accumulated and then applied at the sourcefile visit then we'd need to have calls to record the updates etc. I think it is fine the way it is implemented now (other ChangeXXX recipe behave the same) the versions are cached since pom metadata is cached

@timtebeek timtebeek added the enhancement New feature or request label Dec 24, 2025
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Jan 2, 2026
Copy link
Copy Markdown
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help here @BoykoAlex ! Seems reasonable from my side, as the version resolves you've added are conditional, and wrapped in an update to a cached transient field to limit how often these get called. I've asked Shannon whether that's acceptable to him as well.

Update: discussed in Slack; decided to move forward. Thanks both!

@timtebeek timtebeek merged commit 444d0a0 into openrewrite:main Jan 2, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants