-
Notifications
You must be signed in to change notification settings - Fork 0
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
Plugin sources generation #2
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.
Probably needs documentation, not sure if the PR will pass after merging without docs
...cegen-annotations/src/main/java/io/micronaut/sourcegen/annotations/PluginTaskExecutable.java
Outdated
Show resolved
Hide resolved
.../src/test/groovy/io/micronaut/sourcegen/generator/visitors/GradlePluginGenerationSpec.groovy
Outdated
Show resolved
Hide resolved
var pluginContent = stripImports(files.get("test.WolfPlugin").getCharContent(false)) | ||
pluginContent == """public class WolfPlugin implements Plugin<Project> { | ||
protected WolfExtension createExtension(Project project, Configuration classpath) { | ||
return project.getExtensions().create(WolfExtension.class, "Wolf", DefaultWolfExtension.class, project, classpath); |
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.
The defaults should probably be handled at the extension level, rather than in the task execution.
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.
They are handled on both levels. Not sure if required, but that seems to be the way for current plugins. I suppose this allows using task on its own.
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.
mmm, usually the tasks default to (convention()
) the extension, which itself has convention()
. That should be good.
public void execute(WolfTask arg1) { | ||
arg1.getClasspath().from(this.classpath); | ||
arg1.setDescription("Configure the awooo"); | ||
arg1.getSlogan().convention(this.spec.getSlogan()); |
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.
The defaults are set in extension, too. This configurator sets all the conventions.
So we need this sourcegen to generate a Gradle plugin that would generate plugins :) |
@melix Do you know what might be causing the sonar issue?
|
Is the project created in sonar cloud? |
In checklists we trust! |
961f4f8
to
3015bb0
Compare
3015bb0
to
160f864
Compare
@andriy-dmytruk sonatype is now running but failing :-) |
@andriy-dmytruk can you address the sonar failures :) |
|
@andriy-dmytruk merged this but documentation publishing seems broken |
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.