spring-projects-experimental / spring-boot-migrator

Spring Boot Migrator (SBM) is a tool for automated code migrations to upgrade or migrate to Spring Boot
Apache License 2.0
431 stars 87 forks source link

Revamp/949 move projectresourceset related classes to sbm support rewrite #950

Closed fabapp2 closed 10 months ago

fabapp2 commented 10 months ago

Move ProjectResourceSet and related classes to sbm-support-rewrite and provide a new method `ProjectResourceSet

apply(Recipe...)`.

The apply() method applies a recipe and merges the changes with the in-memory representation of OR AST. This allows sequentially applying recipes while changes get reflected into the AST after each recipe. ProjectResourceSetSerializer#writeChanges(ProjectResourceSet) synchronizes the changes with the FS (add, update, remove).

ProjectResourceSet projectResourceSet = projectResourceSetFactory.create(baseDir, sourceFiles);

Recipe r = ...
projectResourceSet.apply(r);

Recipe anotherRecipe = ...
projectResourceSet.apply(anotherRecipe);

serializer.writeChanges(projectResourceSet);