Skip to content

Commit

Permalink
Merge pull request #18173 from aloubyansky/expose-platform-info
Browse files Browse the repository at this point in the history
Expose collected platform info through the AppModel
  • Loading branch information
gsmet authored Jun 28, 2021
2 parents 049068b + 5179f27 commit 928d732
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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<String, String> getPlatformProperties();

/**
* Quarkus platform release information.
*
* @return platform release information
*/
Collection<PlatformReleaseInfo> getPlatformReleaseInfo();

/**
* All the Quarkus platform BOMs imported by an application.
*
* @return all the Quarkus platform BOMs imported by an application
*/
Collection<AppArtifactCoords> 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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,20 @@ public static boolean isPlatformReleaseInfo(String s) {
private final Map<AppArtifactCoords, PlatformImport> platformImports = new HashMap<>();

final Map<String, String> collectedProps = new HashMap<String, String>();
private final Collection<AppArtifactCoords> platformBoms = new ArrayList<>();
private final Collection<PlatformReleaseInfo> platformReleaseInfo = new ArrayList<>();

public PlatformImportsImpl() {
}

public Collection<PlatformReleaseInfo> getPlatformReleaseInfo() {
return platformReleaseInfo;
}

public Collection<AppArtifactCoords> 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);
Expand All @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 928d732

Please sign in to comment.