use of io.quarkus.bootstrap.app.ArtifactResult in project quarkus by quarkusio.
the class AugmentActionImpl method createProductionApplication.
@Override
public AugmentResult createProductionApplication() {
if (launchMode != LaunchMode.NORMAL) {
throw new IllegalStateException("Can only create a production application when using NORMAL launch mode");
}
ClassLoader classLoader = curatedApplication.createDeploymentClassLoader();
BuildResult result = runAugment(true, Collections.emptySet(), null, classLoader, ArtifactResultBuildItem.class, DeploymentResultBuildItem.class);
writeDebugSourceFile(result);
JarBuildItem jarBuildItem = result.consumeOptional(JarBuildItem.class);
NativeImageBuildItem nativeImageBuildItem = result.consumeOptional(NativeImageBuildItem.class);
List<ArtifactResultBuildItem> artifactResultBuildItems = result.consumeMulti(ArtifactResultBuildItem.class);
BuildSystemTargetBuildItem buildSystemTargetBuildItem = result.consume(BuildSystemTargetBuildItem.class);
// this depends on the fact that the order in which we can obtain MultiBuildItems is the same as they are produced
// we want to write result of the final artifact created
ArtifactResultBuildItem lastResult = artifactResultBuildItems.get(artifactResultBuildItems.size() - 1);
writeArtifactResultMetadataFile(buildSystemTargetBuildItem, lastResult);
return new AugmentResult(artifactResultBuildItems.stream().map(a -> new ArtifactResult(a.getPath(), a.getType(), a.getMetadata())).collect(Collectors.toList()), jarBuildItem != null ? jarBuildItem.toJarResult() : null, nativeImageBuildItem != null ? nativeImageBuildItem.getPath() : null);
}
use of io.quarkus.bootstrap.app.ArtifactResult in project quarkus by quarkusio.
the class RebuildHandler method handlePostAsync.
@Override
protected void handlePostAsync(RoutingContext event, MultiMap form) throws Exception {
QuarkusBootstrap existing = (QuarkusBootstrap) DevConsoleManager.getQuarkusBootstrap();
try (TempSystemProperties properties = new TempSystemProperties()) {
for (Map.Entry<String, String> i : config.entrySet()) {
properties.set(i.getKey(), i.getValue());
}
for (Map.Entry<String, String> i : form.entries()) {
if (!i.getValue().isEmpty()) {
properties.set(i.getKey(), i.getValue());
}
}
QuarkusBootstrap quarkusBootstrap = existing.clonedBuilder().setMode(QuarkusBootstrap.Mode.PROD).setIsolateDeployment(true).build();
try (CuratedApplication bootstrap = quarkusBootstrap.bootstrap()) {
AugmentResult augmentResult = bootstrap.createAugmentor().createProductionApplication();
List<ArtifactResult> containerArtifactResults = augmentResult.resultsMatchingType((s) -> s.contains("container"));
if (containerArtifactResults.size() >= 1) {
flashMessage(event, "Container-image: " + containerArtifactResults.get(0).getMetadata().get("container-image") + " created.", Duration.ofSeconds(10));
}
}
}
;
}
Aggregations