use of io.quarkus.registry.catalog.selection.OriginCombination in project quarkus by quarkusio.
the class UpdateCommandHandler method getRecommendedOrigins.
private static List<ExtensionCatalog> getRecommendedOrigins(ExtensionCatalog extensionCatalog, List<Extension> extensions) throws QuarkusCommandException {
final List<ExtensionOrigins> extOrigins = new ArrayList<>(extensions.size());
for (Extension e : extensions) {
addOrigins(extOrigins, e);
}
final OriginCombination recommendedCombination = OriginSelector.of(extOrigins).calculateRecommendedCombination();
if (recommendedCombination == null) {
final StringBuilder buf = new StringBuilder();
buf.append("Failed to determine a compatible Quarkus version for the requested extensions: ");
buf.append(extensions.get(0).getArtifact().getKey().toGacString());
for (int i = 1; i < extensions.size(); ++i) {
buf.append(", ").append(extensions.get(i).getArtifact().getKey().toGacString());
}
throw new QuarkusCommandException(buf.toString());
}
return recommendedCombination.getUniqueSortedOrigins().stream().map(o -> o.getCatalog()).collect(Collectors.toList());
}
use of io.quarkus.registry.catalog.selection.OriginCombination in project quarkus by quarkusio.
the class CreateProjectCommandHandler method getExtensionOrigins.
private static List<ExtensionCatalog> getExtensionOrigins(ExtensionCatalog extensionCatalog, List<Extension> extensionsToAdd) throws QuarkusCommandException {
final List<ExtensionOrigins> extOrigins = new ArrayList<>(extensionsToAdd.size());
for (Extension e : extensionsToAdd) {
addOrigins(extOrigins, e);
}
if (extOrigins.isEmpty()) {
// legacy 1.x or universe platform
return Collections.emptyList();
}
// we add quarkus-core as a selected extension here only to include the quarkus-bom
// in the list of platforms. quarkus-core won't be added to the generated POM though.
final Optional<Extension> quarkusCore = extensionCatalog.getExtensions().stream().filter(e -> e.getArtifact().getArtifactId().equals("quarkus-core")).findFirst();
if (!quarkusCore.isPresent()) {
throw new QuarkusCommandException("Failed to locate quarkus-core in the extension catalog");
}
addOrigins(extOrigins, quarkusCore.get());
final OriginCombination recommendedCombination = OriginSelector.of(extOrigins).calculateRecommendedCombination();
if (recommendedCombination == null) {
final StringBuilder buf = new StringBuilder();
buf.append("Failed to determine a compatible Quarkus version for the requested extensions: ");
buf.append(extensionsToAdd.get(0).getArtifact().getKey().toGacString());
for (int i = 1; i < extensionsToAdd.size(); ++i) {
buf.append(", ").append(extensionsToAdd.get(i).getArtifact().getKey().toGacString());
}
throw new QuarkusCommandException(buf.toString());
}
return recommendedCombination.getUniqueSortedOrigins().stream().map(o -> o.getCatalog()).collect(Collectors.toList());
}
Aggregations