Skip to content

Commit

Permalink
Clarify recipe run order
Browse files Browse the repository at this point in the history
Fixes: #226
  • Loading branch information
mike-solomon committed Oct 4, 2023
1 parent e8e6bd7 commit fb1361b
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,48 @@ Not right now. This is a particularly difficult problem to address for a couple
* Some recipes can be composed of other recipes which could then include other recipes composed of other recipes and so on.
* Some recipes can be used multiple times in one recipe with different parameters such as in [this example](https://github.com/openrewrite/rewrite-migrate-java/blob/v2.0.6/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml#L140-L160).

There is an [open issue](https://github.com/openrewrite/rewrite-maven-plugin/issues/345) for this request that you can +1 or provide feedback on.
There is an [open issue](https://github.com/openrewrite/rewrite-maven-plugin/issues/345) for this request that you can +1 or provide feedback on.

## What order do recipes run in?

Recipes are run in the order they are activated.

Let's take this example snippet of a `build.gradle` file:

```groovy
rewrite {
activeRecipe(
'com.yourorg.Foo',
'com.yourorg.RecipeA'
)
}
```

and this example of a `rewrite.yml` file:

```yml
---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.RecipeA
displayName: Recipe A
description: Applies Recipe B.
recipeList:
- com.yourorg.RecipeB
- com.yourorg.RecipeC
---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.Foo
...
recipeList:
- com.yourorg.bar
- com.yourorg.bash
```
In this example, the recipes would be run in this order:
1. `com.yourorg.Foo`
2. `com.yourorg.bar`
3. `com.yourorg.bash`
4. `com.yourorg.RecipeA`
5. `com.yourorg.RecipeB`
6. `com.yourorg.RecipeC`

0 comments on commit fb1361b

Please sign in to comment.