Skip to content

feat: merge categories which have matching roots #5288

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 3 commits into
base: main
Choose a base branch
from

Conversation

lkerford
Copy link
Contributor

What's changed?

In the event we "org.openrewrite.java.test" and "io.moderne.java.test", we want the subcategories "java" and "test" to be merged.
-https://github.com/moderneinc/moderne-recipe-execution/issues/1270

What's your motivation?

We are seeing duplicate entries in the market place and this is confusing.

Any additional context

To achieve the removal of these duplicate categories we decided to merge them in the tree.

The path to a category below a category root today (before any changes) is <categoryRoot>.path.to.sub.category, 
for instance, org.openrewrite.path.to.subcategory. We will instead make that path be path.to.sub.category. 
That means we will merge paths of categories such as io.moderne.java and org.openrewrite.java into java. 
If there are subcategories such as io.moderne.java.spring and org.openrewrite.java.spring, these will
 also be merged into java.spring.

In the event we "org.openrewrite.java.test" and "io.moderne.java.test", we want the subcategories "java" and "test" to be merged together.
@@ -52,4 +52,6 @@ public class CategoryDescriptor {
int priority;

boolean synthetic;

Set<String> rootPackages;
Copy link
Member

Choose a reason for hiding this comment

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

Something looks suspicious about this to me. We shouldn't have both packageName and Set of rootPackages. Which of the set of rootPackages does packageName represent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

packageName does not include the root so that we can merge the packages together
while the rootPackages contains all the know subset of roots.

For example org.openrewrite.path.to.subcategory has a packageName of path.to.subcategory and a rootPackages of listof(org.openrewrite)

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we should rename packageName then, to avoid this confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants