Skip to content

UpgradeDependencyVersion recipe does not update properties defined in parent #5633

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jevanlingen
Copy link
Contributor

@jevanlingen jevanlingen commented Jun 17, 2025

What's changed?

When a parent build.gradle defines a property and it's used in a submodule, this property is updated as well.

Anything in particular you'd like reviewers to focus on?

The recipe before this change went through all the method invocations to search for dependency placeholders. Once found, it put the data as cursor message on the compilation unit and then afterwards updates method assignments. This does not work for a parent-child relationship with variables, because we are now talking of multiple source files. So I moved (and refactored) the logic to the scanning phase.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@jevanlingen jevanlingen self-assigned this Jun 17, 2025
@jevanlingen jevanlingen added bug Something isn't working recipe Requested Recipe labels Jun 17, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jun 17, 2025
@jevanlingen jevanlingen force-pushed the upgrade-dependency-version-use-parent-build-gradle-to-define-properties branch from fb65285 to bcffd04 Compare June 17, 2025 12:34
@jevanlingen jevanlingen force-pushed the upgrade-dependency-version-use-parent-build-gradle-to-define-properties branch from ee91176 to f381ea7 Compare June 17, 2025 12:57
@jevanlingen jevanlingen requested a review from sambsnyd June 18, 2025 11:39
@jevanlingen jevanlingen moved this from In Progress to Ready to Review in OpenRewrite Jun 18, 2025
@jevanlingen jevanlingen marked this pull request as ready for review June 18, 2025 11:45
@@ -801,6 +801,111 @@ void versionInParentSubprojectDefinitionWithPropertiesFiles() {
);
}

@Test
void versionInParentPropertiesFiles() {
Copy link
Contributor Author

@jevanlingen jevanlingen Jun 18, 2025

Choose a reason for hiding this comment

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

💡 This test did already pass before this PR. It's just an extra test to prove this kind of setup does also work.

@okundzich
Copy link
Member

please give time to @jkschneider to review

@okundzich okundzich requested a review from jkschneider June 18, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working recipe Requested Recipe
Projects
Status: Ready to Review
Development

Successfully merging this pull request may close these issues.

2 participants