-
Notifications
You must be signed in to change notification settings - Fork 97
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
Features backed by Open rewrite recipes #2703
base: 4.8.x
Are you sure you want to change the base?
Conversation
@alvarosanchez this PR has a lot of package imports changes because I extracted a micronaut-stater-sdk module. Please, ignore those for now. I created a proof of concept of a starter feature consuming a OpenRewrite declarative recipe, in particular Gradle and Maven dependency recipes. See the What do you think? It is still far from complete but this will allow us to define every feature dependencies with open rewrite recipes. We can then move to configuration recipes etc. |
Note that there is Other than that, as far as I can see (the browser crashes with this gigantic PR), you're not really invoking OpenRewrite, but rather using its declarative recipe format as an alternative, internal way to define dependencies. Which, if I'm not mistaken, would end up going the same route of rendering Rocker templates. I don't think we should do this. What I meant was to use OpenRewrite to actually perform changes to an existing project, via an additional command (eg |
d4b4028
to
d79b1d6
Compare
@alvarosanchez I think we are on the same page. I pushed an extra commit which hopefully clarifies the direction I am suggesting. As you said, I want to support both use cases:
Project Modification will invoke OpenRewrite recipes in an existing project. However, I have not implemented that yet. I have pushed a commit with an To gradually add features I have created a marker interface For me, the key is to define things only in a single place. That it is the reason why I created the NOTE: Currently, OpenRewrite does not support adding a gradle dependency to a Gradle file using the Kotlin DSL only the Groovy DSL. Let me know if you think I am going in the right direction. |
extract variable
76021a9
to
362de03
Compare
@@ -1,13 +1,10 @@ | |||
--- | |||
type: specs.openrewrite.org/v1beta/recipe | |||
name: micronaut.starter.feature.mockito.AddDependencyMockito | |||
name: micronaut.starter.feature.Mockito |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convention seems to be using package names.
Also, I'd have a YML per main recipe, instead of having a huge rewrite.yml
. OpenRewrite will detect them all within META-INF/rewrite
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about using multiple files, we can decided about this later. micronaut resource loader api is not super flexible.
public interface OpenRewriteFeature extends Feature { | ||
|
||
@NonNull | ||
String getRecipeName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this also supports using Refaster and imperative recipes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have tried only with declarative recipes. But ideally, we should support every type of recipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could use a default convention such as io.micronaut.starter.feature.${featureName} to ensure unique name
@sdelamo amazing, then we are in agreement! |
@alvarosanchez I have pushed a commit of an example of a feature contributing configuration. d71a1e7 We are going to need to create our own AddProperty implementation similar to AddSpringProperty, or AddQuarkusProperty as the |
No description provided.