Search in sources :

Example 1 with Capabilities

use of io.quarkus.deployment.Capabilities in project camel-quarkus by apache.

the class CamelMainNativeImageProcessor method camelNativeImageResources.

@BuildStep
private void camelNativeImageResources(Capabilities capabilities, BuildProducer<NativeImageResourceBuildItem> nativeResource) {
    for (String path : CamelMainHelper.routesIncludePattern().collect(Collectors.toList())) {
        String scheme = ResourceHelper.getScheme(path);
        // Null scheme is equivalent to classpath scheme
        if (scheme == null || scheme.equals("classpath:")) {
            if (AntPathMatcher.INSTANCE.isPattern(path)) {
                // Classpath directory traversal via wildcard paths does not work on GraalVM.
                // The exact path to the resource has to be looked up
                // https://github.com/oracle/graal/issues/1108
                LOG.warnf("Classpath wildcards does not work in native mode. Resources matching %s will not be loaded.", path);
            } else {
                nativeResource.produce(new NativeImageResourceBuildItem(path.replace("classpath:", "")));
            }
        }
    }
    String[] resources = Stream.of("components", "dataformats", "languages").map(k -> "org/apache/camel/main/" + k + ".properties").toArray(String[]::new);
    nativeResource.produce(new NativeImageResourceBuildItem(resources));
}
Also used : NativeImageResourceBuildItem(io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem) Capabilities(io.quarkus.deployment.Capabilities) BuildStep(io.quarkus.deployment.annotations.BuildStep) ReflectiveClassBuildItem(io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem) ResourceHelper(org.apache.camel.support.ResourceHelper) Stream(java.util.stream.Stream) Logger(org.jboss.logging.Logger) NativeImageResourceBuildItem(io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem) Collectors(java.util.stream.Collectors) AntPathMatcher(org.apache.camel.util.AntPathMatcher) BuildProducer(io.quarkus.deployment.annotations.BuildProducer) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Example 2 with Capabilities

use of io.quarkus.deployment.Capabilities in project kogito-runtimes by kiegroup.

the class KogitoAssetsProcessorTest method validateAvailableCapabilitiesWithOptaPlannerWithRest.

@Test
public void validateAvailableCapabilitiesWithOptaPlannerWithRest() {
    KogitoBuildContext context = QuarkusKogitoBuildContext.builder().build();
    Capabilities capabilities = capabilities(Capability.RESTEASY, Capability.RESTEASY_JSON_JACKSON, "org.optaplanner.optaplanner-quarkus");
    KogitoAssetsProcessor processor = new KogitoAssetsProcessor();
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).isEmpty();
    processor.validateAvailableCapabilities(context, capabilities);
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).isEmpty();
}
Also used : Capabilities(io.quarkus.deployment.Capabilities) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) QuarkusKogitoBuildContext(org.kie.kogito.codegen.api.context.impl.QuarkusKogitoBuildContext) Test(org.junit.jupiter.api.Test)

Example 3 with Capabilities

use of io.quarkus.deployment.Capabilities in project kogito-runtimes by kiegroup.

the class KogitoAssetsProcessorTest method validateAvailableCapabilitiesWithOptaPlannerNoRest.

@Test
public void validateAvailableCapabilitiesWithOptaPlannerNoRest() {
    KogitoBuildContext context = QuarkusKogitoBuildContext.builder().build();
    Capabilities capabilities = capabilities("org.optaplanner.optaplanner-quarkus");
    KogitoAssetsProcessor processor = new KogitoAssetsProcessor();
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).isEmpty();
    processor.validateAvailableCapabilities(context, capabilities);
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).contains("false");
}
Also used : Capabilities(io.quarkus.deployment.Capabilities) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) QuarkusKogitoBuildContext(org.kie.kogito.codegen.api.context.impl.QuarkusKogitoBuildContext) Test(org.junit.jupiter.api.Test)

Example 4 with Capabilities

use of io.quarkus.deployment.Capabilities in project kogito-runtimes by kiegroup.

the class KogitoAssetsProcessorTest method validateAvailableCapabilitiesWithoutOptaPlanner.

@Test
public void validateAvailableCapabilitiesWithoutOptaPlanner() {
    KogitoBuildContext context = QuarkusKogitoBuildContext.builder().build();
    Capabilities capabilities = capabilities(Capability.RESTEASY, Capability.RESTEASY_JSON_JACKSON);
    KogitoAssetsProcessor processor = new KogitoAssetsProcessor();
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).isEmpty();
    processor.validateAvailableCapabilities(context, capabilities);
    assertThat(context.getApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST)).isEmpty();
}
Also used : Capabilities(io.quarkus.deployment.Capabilities) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) QuarkusKogitoBuildContext(org.kie.kogito.codegen.api.context.impl.QuarkusKogitoBuildContext) Test(org.junit.jupiter.api.Test)

Aggregations

Capabilities (io.quarkus.deployment.Capabilities)4 Test (org.junit.jupiter.api.Test)3 KogitoBuildContext (org.kie.kogito.codegen.api.context.KogitoBuildContext)3 QuarkusKogitoBuildContext (org.kie.kogito.codegen.api.context.impl.QuarkusKogitoBuildContext)3 BuildProducer (io.quarkus.deployment.annotations.BuildProducer)1 BuildStep (io.quarkus.deployment.annotations.BuildStep)1 NativeImageResourceBuildItem (io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem)1 ReflectiveClassBuildItem (io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 ResourceHelper (org.apache.camel.support.ResourceHelper)1 AntPathMatcher (org.apache.camel.util.AntPathMatcher)1 Logger (org.jboss.logging.Logger)1