diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImports.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImports.java index b0a047f9c2d41..7114363a228cf 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImports.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImports.java @@ -1,12 +1,43 @@ package io.quarkus.bootstrap.model; +import java.util.Collection; import java.util.Map; public interface PlatformImports { + /** + * Quarkus platform properties aggregated from all the platform an application is based on. + * + * @return aggregated platform properties + */ public Map getPlatformProperties(); + /** + * Quarkus platform release information. + * + * @return platform release information + */ + Collection getPlatformReleaseInfo(); + + /** + * All the Quarkus platform BOMs imported by an application. + * + * @return all the Quarkus platform BOMs imported by an application + */ + Collection getImportedPlatformBoms(); + + /** + * In case Quarkus platform member BOM imports were misaligned this method + * will return a detailed information about what was found to be in conflict. + * + * @return platform member BOM misalignment report or null, in case no conflict was detected + */ public String getMisalignmentReport(); + /** + * Checks whether the platform member BOM imports belong to the same platform release. + * + * @return true if imported platform member BOMs belong to the same platform release, otherwise - false + */ public boolean isAligned(); } diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImportsImpl.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImportsImpl.java index 1524a2c09acf3..8db44fde9de36 100644 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImportsImpl.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImportsImpl.java @@ -43,10 +43,20 @@ public static boolean isPlatformReleaseInfo(String s) { private final Map platformImports = new HashMap<>(); final Map collectedProps = new HashMap(); + private final Collection platformBoms = new ArrayList<>(); + private final Collection platformReleaseInfo = new ArrayList<>(); public PlatformImportsImpl() { } + public Collection getPlatformReleaseInfo() { + return platformReleaseInfo; + } + + public Collection getImportedPlatformBoms() { + return platformBoms; + } + void addPlatformRelease(String propertyName, String propertyValue) { final int platformKeyStreamSep = requiredIndex(propertyName, PLATFORM_KEY_STREAM_SEPARATOR, PROPERTY_PREFIX.length()); final int streamVersionSep = requiredIndex(propertyName, STREAM_VERSION_SEPARATOR, platformKeyStreamSep + 1); @@ -56,7 +66,11 @@ void addPlatformRelease(String propertyName, String propertyValue) { final String version = propertyName.substring(streamVersionSep + 1); allPlatformInfo.computeIfAbsent(platformKey, k -> new PlatformInfo(k)).getOrCreateStream(streamId).addIfNotPresent( version, - () -> new PlatformReleaseInfo(platformKey, streamId, version, propertyValue)); + () -> { + final PlatformReleaseInfo ri = new PlatformReleaseInfo(platformKey, streamId, version, propertyValue); + platformReleaseInfo.add(ri); + return ri; + }); } public void addPlatformDescriptor(String groupId, String artifactId, String classifier, String type, String version) { @@ -66,6 +80,7 @@ public void addPlatformDescriptor(String groupId, String artifactId, String clas null, "pom", version); platformImports.computeIfAbsent(bomCoords, c -> new PlatformImport()).descriptorFound = true; + platformBoms.add(bomCoords); } public void addPlatformProperties(String groupId, String artifactId, String classifier, String type, String version,