Skip to content

Commit d379a5e

Browse files
authored
Merge pull request #45487 from aloubyansky/analytics-quarkus-version
Fix Quarkus platform BOM version info collection for analytics
2 parents f040b40 + 3e7ebdf commit d379a5e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PlatformImportsImpl.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void addPlatformRelease(String propertyName, String propertyValue) {
6767
final String platformKey = propertyName.substring(PROPERTY_PREFIX.length(), platformKeyStreamSep);
6868
final String streamId = propertyName.substring(platformKeyStreamSep + 1, streamVersionSep);
6969
final String version = propertyName.substring(streamVersionSep + 1);
70-
allPlatformInfo.computeIfAbsent(platformKey, k -> new PlatformInfo(k)).getOrCreateStream(streamId).addIfNotPresent(
70+
allPlatformInfo.computeIfAbsent(platformKey, PlatformInfo::new).getOrCreateStream(streamId).addIfNotPresent(
7171
version,
7272
() -> {
7373
final PlatformReleaseInfo ri = new PlatformReleaseInfo(platformKey, streamId, version, propertyValue);
@@ -81,10 +81,7 @@ public void addPlatformDescriptor(String groupId, String artifactId, String clas
8181
artifactId.substring(0,
8282
artifactId.length() - BootstrapConstants.PLATFORM_DESCRIPTOR_ARTIFACT_ID_SUFFIX.length()),
8383
version);
84-
platformImports.computeIfAbsent(bomCoords, c -> {
85-
platformBoms.add(bomCoords);
86-
return new PlatformImport();
87-
}).descriptorFound = true;
84+
platformImports.computeIfAbsent(bomCoords, this::newPlatformImport).descriptorFound = true;
8885
}
8986

9087
public void addPlatformProperties(String groupId, String artifactId, String classifier, String type, String version,
@@ -93,7 +90,7 @@ public void addPlatformProperties(String groupId, String artifactId, String clas
9390
artifactId.substring(0,
9491
artifactId.length() - BootstrapConstants.PLATFORM_PROPERTIES_ARTIFACT_ID_SUFFIX.length()),
9592
version);
96-
platformImports.computeIfAbsent(bomCoords, c -> new PlatformImport());
93+
platformImports.computeIfAbsent(bomCoords, this::newPlatformImport);
9794
importedPlatformBoms.computeIfAbsent(groupId, g -> new ArrayList<>());
9895
if (!importedPlatformBoms.get(groupId).contains(bomCoords)) {
9996
importedPlatformBoms.get(groupId).add(bomCoords);
@@ -117,6 +114,17 @@ public void addPlatformProperties(String groupId, String artifactId, String clas
117114
}
118115
}
119116

117+
/**
118+
* This method is meant to be called when a new platform BOM import was detected.
119+
*
120+
* @param bom platform BOM coordinates
121+
* @return new platform import instance
122+
*/
123+
private PlatformImport newPlatformImport(ArtifactCoords bom) {
124+
platformBoms.add(bom);
125+
return new PlatformImport();
126+
}
127+
120128
public void setPlatformProperties(Map<String, String> platformProps) {
121129
this.collectedProps.putAll(platformProps);
122130
}

0 commit comments

Comments
 (0)