Skip to content

Commit

Permalink
Allow Linux extensions on Windows with containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm committed Oct 7, 2022
1 parent 7d551fd commit 00392e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -5,6 +5,7 @@
import static io.quarkus.dev.console.QuarkusConsole.IS_WINDOWS;

import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.deployment.pkg.NativeConfig;

/**
* Native-image might not be supported for a particular
Expand All @@ -30,4 +31,15 @@ public UnsupportedOSBuildItem(Os os, String error) {
this.os = os;
this.error = error;
}

public boolean triggerError(NativeConfig nativeConfig) {
return
// When the host OS is unsupported, it could have helped to
// run in a Linux builder image (e.g. an extension unsupported on Windows).
(os.active && !nativeConfig.isContainerBuild()) ||
// If Linux is the OS the extension does not support,
// it fails in a container build regardless the host OS,
// because we have only Linux based builder images.
(nativeConfig.isContainerBuild() && os == Os.LINUX);
}
}
Expand Up @@ -891,7 +891,9 @@ public NativeImageInvokerInfo build() {
}

if (unsupportedOSes != null && !unsupportedOSes.isEmpty()) {
final String errs = unsupportedOSes.stream().filter(o -> o.os.active).map(o -> o.error)
final String errs = unsupportedOSes.stream()
.filter(o -> o.triggerError(nativeConfig))
.map(o -> o.error)
.collect(Collectors.joining(", "));
if (!errs.isEmpty()) {
throw new UnsupportedOperationException(errs);
Expand Down

0 comments on commit 00392e7

Please sign in to comment.