Skip to content

Commit

Permalink
Report Quarkus platform version as N/A when there are no platform BOM…
Browse files Browse the repository at this point in the history
…s detected and CUSTOM when platform BOMs are detected but quarkus-bom is not among them
  • Loading branch information
aloubyansky committed Jan 9, 2025
1 parent d2f3938 commit 8c986a6
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 8c986a6

Please sign in to comment.