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

Add preconditions to RecipeDescriptor for DeclarativeRecipe #4259

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions rewrite-core/src/main/java/org/openrewrite/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Setter;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.Nls;
import org.openrewrite.config.DataTableDescriptor;
import org.openrewrite.config.OptionDescriptor;
import org.openrewrite.config.RecipeDescriptor;
Expand Down Expand Up @@ -222,7 +221,7 @@ protected RecipeDescriptor createRecipeDescriptor() {
}

return new RecipeDescriptor(getName(), getDisplayName(), getDescription(), getTags(),
getEstimatedEffortPerOccurrence(), options, recipeList1, getDataTableDescriptors(),
getEstimatedEffortPerOccurrence(), options, Collections.emptyList(), recipeList1, getDataTableDescriptors(),
getMaintainers(), getContributors(), getExamples(), recipeSource);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,13 @@ protected RecipeDescriptor createRecipeDescriptor() {
for (Recipe childRecipe : getRecipeList()) {
recipeList.add(childRecipe.getDescriptor());
}
List<RecipeDescriptor> preconditionsList = new ArrayList<>();
for (Recipe childRecipe : preconditions) {
recipeList.add(childRecipe.getDescriptor());
}
return new RecipeDescriptor(getName(), getDisplayName(), getDescription(),
getTags(), getEstimatedEffortPerOccurrence(),
emptyList(), recipeList, getDataTableDescriptors(), getMaintainers(), getContributors(),
emptyList(), preconditionsList, recipeList, getDataTableDescriptors(), getMaintainers(), getContributors(),
getExamples(), source);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class RecipeDescriptor {
@EqualsAndHashCode.Include
List<OptionDescriptor> options;

List<RecipeDescriptor> preconditions;

@With
List<RecipeDescriptor> recipeList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void putRecipe() {

private static RecipeDescriptor recipeDescriptor(String packageName) {
return new RecipeDescriptor(packageName + ".MyRecipe",
"My recipe", "", emptySet(), null, emptyList(),
"My recipe", "", emptySet(), null, emptyList(), emptyList(),
emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), URI.create("https://openrewrite.org"));
}

Expand Down
Loading