Skip to content

Commit

Permalink
Introduce quarkus-core-compatibility extension metadata
Browse files Browse the repository at this point in the history
This introduces a `quarkus-core-compatibility` metadata in the extension YAML descriptor. It should serve as an indicator for core compatibilty for a given Quarkus version.
The format is `[major.minor,)`.
  • Loading branch information
gastaldi committed Jul 16, 2024
1 parent 75b4ed4 commit 7c23286
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
24 changes: 13 additions & 11 deletions docs/src/main/asciidoc/extension-metadata.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ metadata:
artifact: "io.quarkus:quarkus-project-core-extension-codestarts::jar:999-SNAPSHOT"
config:
- "quarkus.rest."
built-with-quarkus-core: "999-SNAPSHOT" <1>
capabilities: <2>
built-with-quarkus-core: "3.8.5" <1>
quarkus-core-compatibility: "[3.8,)" <2>
capabilities: <3>
provides:
- "io.quarkus.rest"
- "io.quarkus.resteasy.reactive"
extension-dependencies: <3>
extension-dependencies: <4>
- "io.quarkus:quarkus-rest-common"
- "io.quarkus:quarkus-mutiny"
- "io.quarkus:quarkus-smallrye-context-propagation"
Expand All @@ -101,17 +102,18 @@ metadata:
- "io.quarkus:quarkus-jsonp"
description: "A Jakarta REST implementation utilizing build time processing and Vert.x.\
\ This extension is not compatible with the quarkus-resteasy extension, or any of\
\ the extensions that depend on it." <4>
scm-url: "https://github.com/quarkusio/quarkus" <5>
sponsor: A Sponsoring Organisation <6>
\ the extensions that depend on it." <5>
scm-url: "https://github.com/quarkusio/quarkus" <6>
sponsor: A Sponsoring Organisation <7>
----

<1> Quarkus version the extension was built with
<2> https://quarkus.io/guides/capabilities[Capabilities] this extension provides
<3> Direct dependencies on other extensions
<4> Description that can be displayed to users. In this case, the description was copied from the `pom.xml` of the extension module but it could also be provided in the template file.
<5> The source code repository of this extension. Optional, and will often be set automatically using the `<scm>` information in the pom. In GitHub Actions builds, it will be inferred from the CI environment. For other GitHub repositories, it can be controlled by setting a `GITHUB_REPOSITORY` environment variable.
<6> The sponsor(s) of this extension. Optional, and will sometimes be determined automatically from commit history.
<2> Quarkus version compatibility range. It could also be provided in the template file.
<3> https://quarkus.io/guides/capabilities[Capabilities] this extension provides
<4> Direct dependencies on other extensions
<5> Description that can be displayed to users. In this case, the description was copied from the `pom.xml` of the extension module but it could also be provided in the template file.
<6> The source code repository of this extension. Optional, and will often be set automatically using the `<scm>` information in the pom. In GitHub Actions builds, it will be inferred from the CI environment. For other GitHub repositories, it can be controlled by setting a `GITHUB_REPOSITORY` environment variable.

Check warning on line 115 in docs/src/main/asciidoc/extension-metadata.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'. Raw Output: {"message": "[Quarkus.TermsSuggestions] Depending on the context, consider using 'by using' or 'that uses' rather than 'using'.", "location": {"path": "docs/src/main/asciidoc/extension-metadata.adoc", "range": {"start": {"line": 115, "column": 96}}}, "severity": "INFO"}
<7> The sponsor(s) of this extension. Optional, and will sometimes be determined automatically from commit history.

[[quarkus-extension-properties]]
== META-INF/quarkus-extension.properties

Check warning on line 119 in docs/src/main/asciidoc/extension-metadata.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Headings] Use sentence-style capitalization in 'META-INF/quarkus-extension.properties'. Raw Output: {"message": "[Quarkus.Headings] Use sentence-style capitalization in 'META-INF/quarkus-extension.properties'.", "location": {"path": "docs/src/main/asciidoc/extension-metadata.adoc", "range": {"start": {"line": 119, "column": 4}}}, "severity": "INFO"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.concurrent.atomic.AtomicReference;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Scm;
import org.apache.maven.plugin.AbstractMojo;
Expand Down Expand Up @@ -620,6 +621,11 @@ private void setBuiltWithQuarkusCoreVersion(ObjectNode extObject) throws MojoExe
if (coreVersionLocator.coreVersion != null) {
ObjectNode metadata = getMetadataNode(extObject);
metadata.put("built-with-quarkus-core", coreVersionLocator.coreVersion);
if (!metadata.has("quarkus-core-compatibility")) {
DefaultArtifactVersion dav = new DefaultArtifactVersion(coreVersionLocator.coreVersion);
String compatibilityRange = "[" + dav.getMajorVersion() + "." + dav.getMinorVersion() + ",)";
metadata.put("quarkus-core-compatibility", compatibilityRange);
}
} else if (!ignoreNotDetectedQuarkusCoreVersion) {
throw new MojoExecutionException("Failed to determine the Quarkus core version used to build the extension");
}
Expand Down

0 comments on commit 7c23286

Please sign in to comment.