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

Make AddPluginsBom Order Independent #57

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Conversation

sghill
Copy link
Collaborator

@sghill sghill commented Dec 6, 2023

What's changed?

AddPluginsBom recipe now supports properties declared after the bom.

What's your motivation?

Several plugins have this ordering defined. It worked in the previous ScanningRecipe implementation, this restores the behavior with a regular Recipe.

Have you considered any alternatives or workarounds?

Recipe causing another cycle, but this seems simpler.

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

@sghill sghill added the bug Something isn't working label Dec 6, 2023
@sghill sghill self-assigned this Dec 6, 2023
Copy link
Contributor

@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.

Looks good to me, aside from the suggestion to use cursor messaging instead of visitor fields, and run https://docs.openrewrite.org/recipes/maven/orderpomelements as a first step to ensure the projects conform to the pom code convention

@timtebeek
Copy link
Contributor

This one has started to fail, possibly due to a new wildcard version getting picked up

ModernizePluginTest > shouldDoTheWorks() FAILED
    org.opentest4j.AssertionFailedError: [Unexpected result in "pom.xml":
diff --git a/pom.xml b/pom.xml
index 3dc2751..cedb28d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@ 
             <dependency>
                 <groupId>io.jenkins.tools.bom</groupId>
                 <artifactId>bom-2.401.x</artifactId>
-                <version>2612.v3d6a_2128c0ef</version>
+                <version>2641.v88e707466454</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>

We also have mechanisms for tests to verify not an exact version, through Consumer<SourceSpec<SourceFile>>. Let me know if you need help to set that up!

@timtebeek
Copy link
Contributor

Rewrote one test to indeed not break when a new version comes out; hope that helps!
063e664

@sghill
Copy link
Collaborator Author

sghill commented Dec 14, 2023

Thanks Tim!

@sghill sghill force-pushed the bugfix/bom-property-order branch from 7de7d44 to d87e018 Compare April 19, 2024 17:50
@sghill sghill force-pushed the bugfix/bom-property-order branch from d87e018 to a9b94e9 Compare April 19, 2024 18:16
@sghill
Copy link
Collaborator Author

sghill commented Apr 19, 2024

Looks good to me, aside from the suggestion to use cursor messaging instead of visitor fields, and run https://docs.openrewrite.org/recipes/maven/orderpomelements as a first step to ensure the projects conform to the pom code convention

Thanks for the suggestion @timtebeek! This has been updated to use cursor messaging.

@sghill sghill merged commit 17cdebb into main Apr 19, 2024
2 checks passed
@sghill sghill deleted the bugfix/bom-property-order branch April 19, 2024 18:19
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
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants