Record noteworthy build items into extension metadata #40306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How do we know which extensions provide a dev service? At the moment, we don't, except by manual inspection. This PR automates the generation of metadata about noteworthy extension capabilities, that we might want to surface into aggregated lists or filters on http://extensions.quarkus.io and http://code.quarkus.io.
This metadata is needed to implement quarkusio/extensions#983. It could also potentially help with quarkusio/quarkusio.github.io#1869. At the moment we maintain the guide page listing extensions with dev services manually, but that page could have generated content injected into it, once we have the right metadata.
For now, I've focussed on dev services, but this capability could be useful for other extension abilities that we might want to surface.
Outstanding work
List<DevServicesResultBuildItem>
Externals
A build item can be annotated with
and that will be converted into the following line in
quarkus-extension.yaml
:(can change to more detailed values)
(I went with a 'provides' verb since
feature
andcapabilties
are already taken :) )Under the hood
I've used the annotation processor to inspect the build item annotations and generate a
noteworthy-build-items.list
file if one is found.The extension descriptor mojo then reads the file and generates the appropriate yaml.
Circular dependency woe
At the moment, this only generates the right information if it's not built on a clean machine. That's ... unfortunate.
The
noteworthy-build-items.list
file is generated in the deployment module, and theQuarkus-extension.yaml
file which uses it is generated in the runtime module … which gets built first.On some earlier iterations of this change, I thought everything was working, but it was actually only working because the runtime module was picking up dirty content from earlier deployment builds. Because phases are not interleaved in a multi-module project,
mvn clean install
on an extension gave me the expected result, but it's not actually representative of a build on a clean machine. For that, it needs to bemvn clean && mvn install
, and with that command, the metadata is not generated. :(For example, to try out the bad sequence,
A solution is needed, hence marking this as draft. I cannot see any mechanism to interleave phases in a multi-module project, which is what's needed here. The only way to do it seems to be multiple invocations (for example,
mvn compile && mvn install
), which is seriously non-ideal.Next steps (once/if the circular problem is fixed)
I think this same mechanism could be useful for lifting the restriction that, in order to be visible to the tools, capabilities have to be registered in the pom.xml rather than returned as
CapabilityBuildItems
in an extension processor. Doing that would need a small amount of extra notation and a small externals change, so that a processor would return something likeand the yaml entry would be something like
I will leave that as a follow-on.
Minor other changes
I noticed that
```
BUILD_STEPS_PATH = META_INF + "/quarkus-build-steps.list";