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

Fix Quarkus platform BOM version info collection for analytics #45487

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
Expand Up @@ -67,7 +67,7 @@ void addPlatformRelease(String propertyName, String propertyValue) {
final String platformKey = propertyName.substring(PROPERTY_PREFIX.length(), platformKeyStreamSep);
final String streamId = propertyName.substring(platformKeyStreamSep + 1, streamVersionSep);
final String version = propertyName.substring(streamVersionSep + 1);
allPlatformInfo.computeIfAbsent(platformKey, k -> new PlatformInfo(k)).getOrCreateStream(streamId).addIfNotPresent(
allPlatformInfo.computeIfAbsent(platformKey, PlatformInfo::new).getOrCreateStream(streamId).addIfNotPresent(
version,
() -> {
final PlatformReleaseInfo ri = new PlatformReleaseInfo(platformKey, streamId, version, propertyValue);
Expand All @@ -81,10 +81,7 @@ public void addPlatformDescriptor(String groupId, String artifactId, String clas
artifactId.substring(0,
artifactId.length() - BootstrapConstants.PLATFORM_DESCRIPTOR_ARTIFACT_ID_SUFFIX.length()),
version);
platformImports.computeIfAbsent(bomCoords, c -> {
platformBoms.add(bomCoords);
return new PlatformImport();
}).descriptorFound = true;
platformImports.computeIfAbsent(bomCoords, this::newPlatformImport).descriptorFound = true;
}

public void addPlatformProperties(String groupId, String artifactId, String classifier, String type, String version,
Expand All @@ -93,7 +90,7 @@ public void addPlatformProperties(String groupId, String artifactId, String clas
artifactId.substring(0,
artifactId.length() - BootstrapConstants.PLATFORM_PROPERTIES_ARTIFACT_ID_SUFFIX.length()),
version);
platformImports.computeIfAbsent(bomCoords, c -> new PlatformImport());
platformImports.computeIfAbsent(bomCoords, this::newPlatformImport);
importedPlatformBoms.computeIfAbsent(groupId, g -> new ArrayList<>());
if (!importedPlatformBoms.get(groupId).contains(bomCoords)) {
importedPlatformBoms.get(groupId).add(bomCoords);
Expand All @@ -117,6 +114,17 @@ public void addPlatformProperties(String groupId, String artifactId, String clas
}
}

/**
* This method is meant to be called when a new platform BOM import was detected.
*
* @param bom platform BOM coordinates
* @return new platform import instance
*/
private PlatformImport newPlatformImport(ArtifactCoords bom) {
platformBoms.add(bom);
return new PlatformImport();
}

public void setPlatformProperties(Map<String, String> platformProps) {
this.collectedProps.putAll(platformProps);
}
Expand Down
Loading