Skip to content
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

Api to read minimum and recommended Java versions from catalog metadata #37236

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,12 @@ public List<ProcessedCategory> getProcessedCategoriesInOrder() {
public static MetadataValue getMetadataValue(ExtensionCatalog catalog, String path) {
return MetadataValue.get(catalog.getMetadata(), path);
}

public static String getMinimumJavaVersion(ExtensionCatalog catalog) {
return getMetadataValue(catalog, ExtensionCatalog.MD_MINIMUM_JAVA_VERSION).asString();
}

public static String getRecommendedJavaVersion(ExtensionCatalog catalog) {
return getMetadataValue(catalog, ExtensionCatalog.MD_RECOMMENDED_JAVA_VERSION).asString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Locale;
import java.util.Map;

final class MetadataValue {
public final class MetadataValue {
private static final MetadataValue EMPTY_METADATA_VALUE = new MetadataValue(null);
private final Object val;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@
"gradle-plugin-id": "io.quarkus",
"gradle-plugin-version": "999-FAKE",
"supported-maven-versions": "[3.6.2,)",
"minimum-java-version": "11",
"recommended-java-version": "17",
"proposed-maven-version": "3.9.5",
"maven-wrapper-version": "3.2.0",
"gradle-wrapper-version": "8.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

public interface ExtensionCatalog extends ExtensionOrigin {

String MD_MINIMUM_JAVA_VERSION = "project.properties.minimum-java-version";
String MD_RECOMMENDED_JAVA_VERSION = "project.properties.recommended-java-version";

/**
* All the origins this catalog is derived from.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.quarkus.platform.catalog;

import static io.quarkus.devtools.testing.FakeExtensionCatalog.newFakeExtensionCatalog;
import static io.quarkus.platform.catalog.processor.CatalogProcessor.getMinimumJavaVersion;
import static io.quarkus.platform.catalog.processor.CatalogProcessor.getProcessedCategoriesInOrder;
import static io.quarkus.platform.catalog.processor.CatalogProcessor.getRecommendedJavaVersion;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Objects;
Expand All @@ -27,6 +29,13 @@ void testCategoryOrder() {
.startsWith("web", "core", "reactive", "serialization", "compatibility", "alt-languages", "uncategorized");
}

@Test
void testJavaVersions() {
final ExtensionCatalog catalog = newFakeExtensionCatalog();
assertThat(getMinimumJavaVersion(catalog)).isEqualTo("11");
assertThat(getRecommendedJavaVersion(catalog)).isEqualTo("17");
}

@Test
void testExtensionsOrder() {
final ExtensionCatalog catalog = newFakeExtensionCatalog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"supported-maven-versions": "${supported-maven-versions}",
"proposed-maven-version": "${proposed-maven-version}",
"maven-wrapper-version": "${maven-wrapper.version}",
"gradle-wrapper-version": "${gradle-wrapper.version}"
"gradle-wrapper-version": "${gradle-wrapper.version}",
"minimum-java-version": "${minimum-java-version}",
"recommended-java-version": "${recommended-java-version}"
}
},
"codestarts-artifacts": [
Expand Down
Loading