Skip to content

Commit

Permalink
Merge pull request #45501 from aloubyansky/analytics-custom-quarkus-v…
Browse files Browse the repository at this point in the history
…ersion

Analytics: report Quarkus platform as CUSTOM when it's not recognized
  • Loading branch information
aloubyansky authored Jan 10, 2025
2 parents e062cb5 + b603789 commit f040b40
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.TextStyle;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -258,10 +259,15 @@ private boolean allEnvSet(String... names) {
}

private String getQuarkusVersion(ApplicationModel applicationModel) {
return applicationModel.getPlatforms().getImportedPlatformBoms().stream()
final Collection<ArtifactCoords> platformBoms = applicationModel.getPlatforms().getImportedPlatformBoms();
if (platformBoms.isEmpty()) {
// Typically, this situation should result in a build error, but it's not up to this service to fail it
return "N/A";
}
return platformBoms.stream()
.filter(artifactCoords -> artifactCoords.getArtifactId().equals("quarkus-bom"))
.map(ArtifactCoords::getVersion)
.findFirst()
.orElse("N/A");
.orElse("CUSTOM");
}
}

0 comments on commit f040b40

Please sign in to comment.