-
Notifications
You must be signed in to change notification settings - Fork 4
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
Prototype plugin stubs generation #209 #232
Conversation
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.
That's fairly impressive work already! I haven't performed a full review yet, only tried to understand the basics. What would probably help is some unit tests which assert the generated sources: currently the test suite projects use the generated code, but we can't "see" it so it's hard to tell how "correct" the generated code is. For example, this generates plugin code, but I'd like to understand better how well it integrates.
...plugin-gradle/src/test/java/io/micronaut/sourcegen/example/plugin/gradle/TestPluginTest.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/micronaut/sourcegen/generator/visitors/gradle/builder/GradleTaskBuilder.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/micronaut/sourcegen/generator/visitors/gradle/builder/GradleTaskBuilder.java
Outdated
Show resolved
Hide resolved
@melix Yes, you are right. I added some simple tests that verify the generated sources |
...lugin-annotations/src/main/java/io/micronaut/sourcegen/annotations/GenerateGradlePlugin.java
Outdated
Show resolved
Hide resolved
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
can you address the Sonar failures? |
Could you move this to a different project? I don't think we should put everything related to the source generation to this project. |
good point, might make sense in a new project. |
Closing in favor of micronaut-projects/micronaut-build-plugin-sourcegen#2 |
This adds support for generating Maven and Gradle stubs (#209).
Description
A plugin task configuration can be provided in a micronaut repo, like
micronaut-json-schema
. It is marked and configured using@PluginTask
annotation. Then,@GenerateGradlePlugin
or@GenerateMavenMojo
annotations can be used in plugin repositories to generate plugin sources.This has the advantage:
As an example, OpenAPI plugin has more than 40 parameters, which can be added and modified. This would simplify that effort.
Example
Example is provided in the
test-suite-plugin-
.A plugin task can be configured with
Then gradle and maven sources can be generated by triggering annotations:
This generates Gradle plugin, extension, specifications and tasks. For maven it generates maven mojos.
Test suite provides a more complete example.
Gradle extension and maven mojos are extended with implementation-specific details and also tests are shown.