Skip to content
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

Do not override version property placeholder in UpgradeDependencyVersion #4579

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dimijdriven
Copy link

@dimijdriven dimijdriven commented Oct 14, 2024

What's changed?

bug-474: added relevant test, in some cases the provided requested value contains the version, I added an extra check getting the value directly from the pom

What's your motivation?

The provided requested versions was not always correct

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

Anyone you would like to review specifically?

@Laurens-W

Have you considered any alternatives or workarounds?

Any additional context

This solves half the issue, it stops the placeholder from being replaced from the version.
The spring boot version is still not upgraded, but this is because of the way that the upgrade call is done
with org.springframework and not with org.springframework.boot

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

@Laurens-W Laurens-W requested a review from timtebeek October 14, 2024 09:37
@Laurens-W Laurens-W added the bug Something isn't working label Oct 14, 2024
@timtebeek timtebeek changed the title bug-474: added relevant test, in some cases the provided requested va… Do not override version property placeholder in UpgradeDependencyVersion Oct 14, 2024
dimijdriven and others added 2 commits October 14, 2024 13:06
…dencyVersion.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
void upgradePropertyAdditionalCheck() {
rewriteRun(
spec -> spec.recipe(new UpgradeDependencyVersion("org.springframework", "*", "5.2.x", "",
false, null)).expectedCyclesThatMakeChanges(2),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check once more whether we can reduce the amount of cycles to 1?
Enforcing that all recipes complete in 1 cycle is something that's being looked at

<name>example</name>
<description>Demo project for Spring Boot</description>
<properties>
<spring.boot.version>2.2.13.RELEASE</spring.boot.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

This version property should be updated too, right?

Copy link
Author

Choose a reason for hiding this comment

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

Indeed in the ticket it expects to upgade also the boot dependency, but this should be done in the rewrite-spring repository in this file resources/META-INF/rewrite/spring-framework-53.yml file

In the rewrite-spring repository the recipe is invoked with the following properties
groupId: org.springframework
artifactId: "*"
newVersion: 5.3.x

I used the same for this test.
To upgrade the boot dependency, something like this should be added:

  • org.openrewrite.java.dependencies.UpgradeDependencyVersion:
    groupId: org.springframework.boot
    artifactId: "*"
    newVersion: 2.x

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, didn't read the group id properly, you are right :)

@timtebeek timtebeek self-requested a review October 22, 2024 12:41
@timtebeek timtebeek marked this pull request as draft October 27, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

spring-boot-22 and -23 recipes are overwriting version placeholder with version
3 participants