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

Expose collected platform info through the AppModel #18173

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
@@ -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