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

Parse only what's needed to run the recipe #3693

Closed
yeikel opened this issue Nov 15, 2023 · 1 comment
Closed

Parse only what's needed to run the recipe #3693

yeikel opened this issue Nov 15, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@yeikel
Copy link
Contributor

yeikel commented Nov 15, 2023

What problem are you trying to solve?

While trying to run the org.openrewrite.maven.OrderPomElements recipe, I was hoping that it would only parse and process my pom files and apply the transformations needed

What I noticed however is that it seems to be scanning all the source files instead

[INFO] --- rewrite:5.11.0:run (default-cli) @ ---
[INFO] Using active recipe(s) [org.openrewrite.maven.OrderPomElements]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] Project [parent] Resolving Poms...
[INFO] Project [parent] Parsing source files
[INFO] Project [child project 1] Parsing source files
[INFO] Project [child project 2] Parsing source files
[INFO] Project [child project 3] Parsing source files
[INFO] Project [child project 4] Parsing source files

Describe the solution you'd like

In an ideal world, recipes that do not need to modify Java files like this one only parse what is needed. To process and reformat a few XML files, I'd expect the recipe to run in a few milliseconds at most

Have you considered any alternatives or workarounds?

I am not aware of any alternatives

Additional context

The reason I suspect that this scanned my entire source files is that the build took over 5 minutes to complete when changing a few pom files should not take that long

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:11 min (Wall Clock)
[INFO] Finished at: 2023-11-15T15:37:27-05:00
@yeikel yeikel added the enhancement New feature or request label Nov 15, 2023
@timtebeek timtebeek added the duplicate This issue or pull request already exists label Nov 29, 2023
@timtebeek
Copy link
Contributor

Hi @yeikel ; Thanks for the suggestion! We did this in a distant past, but have stopped doing this as it's nowadays quite common for scanning recipes to operate across file types, for instance only adding a dependency if a particular Java type is used. Such cases make it relatively rare for any recipe to only affect one particular file type, and the logic to track and selectively parse would make this quite complicated quickly. It'll almost certainly have to land in both of the plugins, and since you're using Maven I suggest to close this issue and watch this one for any work towards this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants