diff --git a/drools/kogito-dmn/src/main/java/org/kie/kogito/dmn/KogitoDecisions.java b/drools/kogito-dmn/src/main/java/org/kie/kogito/dmn/KogitoDecisions.java
new file mode 100644
index 00000000000..2828d8e2991
--- /dev/null
+++ b/drools/kogito-dmn/src/main/java/org/kie/kogito/dmn/KogitoDecisions.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.dmn;
+
+/**
+ * Marker interface used to check DMN engine availability
+ */
+public interface KogitoDecisions {
+}
diff --git a/drools/kogito-drools/src/main/java/org/kie/kogito/KogitoDrools.java b/drools/kogito-drools/src/main/java/org/kie/kogito/KogitoDrools.java
new file mode 100644
index 00000000000..6b72e59aab2
--- /dev/null
+++ b/drools/kogito-drools/src/main/java/org/kie/kogito/KogitoDrools.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito;
+
+/**
+ * Marker interface used to check Drools engine availability
+ */
+public interface KogitoDrools {
+}
diff --git a/drools/kogito-pmml/src/main/java/org/kie/kogito/pmml/KogitoPredictions.java b/drools/kogito-pmml/src/main/java/org/kie/kogito/pmml/KogitoPredictions.java
new file mode 100644
index 00000000000..ba50739fcaf
--- /dev/null
+++ b/drools/kogito-pmml/src/main/java/org/kie/kogito/pmml/KogitoPredictions.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.pmml;
+
+/**
+ * Marker interface used to check PMML engine availability
+ */
+public interface KogitoPredictions {
+}
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/invoker.properties b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/invoker.properties
new file mode 100644
index 00000000000..cf8d445aea4
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/invoker.properties
@@ -0,0 +1,19 @@
+#
+# Copyright 2021 Red Hat, Inc. and/or its affiliates.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# disable verbose local download output
+invoker.mavenOpts=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/pom.xml b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/pom.xml
new file mode 100644
index 00000000000..a0271d76148
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/pom.xml
@@ -0,0 +1,132 @@
+
+ 4.0.0
+
+ org.kie.kogito
+ integration-tests-springboot-norest-it
+ @project.version@
+
+
+
+
+ org.kie.kogito
+ kogito-springboot-bom
+ ${project.version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+
+
+
+
+
+
+
+ org.kie.kogito
+ kogito-api
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+
+ io.rest-assured
+ json-schema-validator
+ test
+
+
+
+ io.rest-assured
+ rest-assured
+ test
+
+
+
+ org.springdoc
+ springdoc-openapi-ui
+ @version.org.springdoc@
+
+
+ io.swagger.parser.v3
+ swagger-parser
+ @version.io.swagger.parser.v3@
+ test
+
+
+ io.swagger.parser.v3
+ swagger-parser-v2-converter
+
+
+
+
+
+
+
+ ${project.artifactId}
+
+
+ maven-compiler-plugin
+ @version.compiler.plugin@
+
+ @maven.compiler.release@
+
+
+
+ org.kie.kogito
+ kogito-maven-plugin
+ ${project.version}
+ true
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ @version.org.springframework.boot@
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ @version.surefire.plugin@
+
+
+ org/kie/kogito/integrationtests/springboot/*
+
+
+ @container.image.kafka@
+
+
+
+
+
+
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/java/org/kie/kogito/examples/KogitoSpringbootApplication.java b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/java/org/kie/kogito/examples/KogitoSpringbootApplication.java
new file mode 100644
index 00000000000..95dabe31f07
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/java/org/kie/kogito/examples/KogitoSpringbootApplication.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.examples;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages={"org.kie.dmn.kogito.**", "org.kie.kogito.**", "http*.**"})
+public class KogitoSpringbootApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(KogitoSpringbootApplication.class, args);
+ }
+}
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/PMMLRegression.pmml b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/PMMLRegression.pmml
new file mode 100644
index 00000000000..2c18ff0c235
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/PMMLRegression.pmml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/Traffic Violation.dmn b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/Traffic Violation.dmn
new file mode 100644
index 00000000000..296c8ca8bd4
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/Traffic Violation.dmn
@@ -0,0 +1,233 @@
+
+
+
+
+
+ string
+
+
+ number
+
+
+ string
+
+
+ string
+
+
+ number
+
+
+
+
+ string
+
+
+ date
+
+
+ string
+
+ "speed", "parking", "driving under the influence"
+
+
+
+ number
+
+
+ number
+
+
+
+
+ number
+
+
+ number
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Violation.Type
+
+
+ "speed", "parking", "driving under the influence"
+
+
+
+
+ Violation.Actual Speed - Violation.Speed Limit
+
+
+
+
+
+
+ "speed"
+
+
+ [10..30)
+
+
+ 500
+
+
+ 3
+
+
+
+
+ "speed"
+
+
+ >= 30
+
+
+ 1000
+
+
+ 7
+
+
+
+
+ "parking"
+
+
+ -
+
+
+ 100
+
+
+ 1
+
+
+
+
+ "driving under the influence"
+
+
+ -
+
+
+ 1000
+
+
+ 5
+
+
+
+
+
+
+
+
+ Should the driver be suspended due to points on his license?
+ "Yes", "No"
+
+
+
+
+
+
+
+
+
+
+
+ Driver.Points + Fine.Points
+
+
+
+
+ if Total Points >= 20 then "Yes" else "No"
+
+
+
+
+
+
+
+
+
+ 50.0
+ 254.0
+ 329.0
+ 119.0
+ 100.0
+ 186.0
+
+
+ 50.0
+ 100.0
+ 398.0
+
+
+ 398.0
+
+
+ 398.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/org/kie/kogito/examples/Hello.drl b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/org/kie/kogito/examples/Hello.drl
new file mode 100644
index 00000000000..e6d2073438d
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/org/kie/kogito/examples/Hello.drl
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.examples;
+unit Hello;
+
+rule helloWorld
+when
+ $s: /strings[ this == "hello" ]
+then
+ strings.add("world");
+end
+
+query hello
+ $s : /strings
+end
\ No newline at end of file
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/test-process.bpmn b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/test-process.bpmn
new file mode 100644
index 00000000000..debd50adbb7
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/main/resources/test-process.bpmn
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoEndpointTest.java b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoEndpointTest.java
new file mode 100644
index 00000000000..b6b0dec5279
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoEndpointTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.spring;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import io.restassured.RestAssured;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.parser.OpenAPIV3Parser;
+import io.swagger.v3.parser.core.models.ParseOptions;
+import io.swagger.v3.parser.core.models.SwaggerParseResult;
+
+import org.kie.kogito.examples.KogitoSpringbootApplication;
+
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = KogitoSpringbootApplication.class)
+public class NoEndpointTest {
+
+ @Test
+ public void noEndpointTest() {
+ String url = RestAssured.baseURI + ":" + RestAssured.port + "/v3/api-docs";
+ ParseOptions parseOptions = new ParseOptions();
+ parseOptions.setResolve(true);
+ SwaggerParseResult result = new OpenAPIV3Parser().readLocation(url, null, parseOptions);
+
+ assertThat(result.getMessages()).isEmpty();
+
+ OpenAPI openAPI = result.getOpenAPI();
+ assertThat(openAPI.getPaths()).isEmpty();
+ }
+}
diff --git a/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoRuntimeTest.java b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoRuntimeTest.java
new file mode 100644
index 00000000000..310b4bdd2de
--- /dev/null
+++ b/integration-tests/integration-tests-springboot/src/it/integration-tests-springboot-noruntimes-it/src/test/java/org/kie/kogito/spring/NoRuntimeTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.spring;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.kie.kogito.Application;
+import org.kie.kogito.decision.DecisionModels;
+import org.kie.kogito.prediction.PredictionModels;
+import org.kie.kogito.process.Processes;
+import org.kie.kogito.rules.RuleUnits;
+import org.kie.kogito.examples.KogitoSpringbootApplication;
+
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = KogitoSpringbootApplication.class)
+public class NoRuntimeTest {
+
+ @Autowired
+ Collection decisionModels;
+
+ @Autowired
+ Collection ruleUnits;
+
+ @Autowired
+ Collection processes;
+
+ @Autowired
+ Collection predictionModels;
+
+ @Autowired
+ Application application;
+
+ @Test
+ public void testEvaluateTrafficViolation() {
+ assertThat(decisionModels).hasSize(0);
+ assertThat(application.get(DecisionModels.class)).isNull();
+
+ assertThat(ruleUnits).hasSize(0);
+ assertThat(application.get(RuleUnits.class)).isNull();
+
+ assertThat(processes).hasSize(0);
+ assertThat(application.get(Processes.class)).isNull();
+
+ assertThat(predictionModels).hasSize(0);
+ assertThat(application.get(PredictionModels.class)).isNull();
+ }
+}
diff --git a/jbpm/jbpm-bpmn2/src/main/java/org/kie/kogito/process/KogitoProcesses.java b/jbpm/jbpm-bpmn2/src/main/java/org/kie/kogito/process/KogitoProcesses.java
new file mode 100644
index 00000000000..21f20e3b881
--- /dev/null
+++ b/jbpm/jbpm-bpmn2/src/main/java/org/kie/kogito/process/KogitoProcesses.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.process;
+
+/**
+ * Marker interface used to check BPMN engine availability
+ */
+public interface KogitoProcesses {
+}
diff --git a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java
index ce63cc67341..db8e0af53fb 100644
--- a/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java
+++ b/kogito-maven-plugin/src/main/java/org/kie/kogito/maven/plugin/AbstractKieMojo.java
@@ -18,7 +18,10 @@
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
@@ -29,6 +32,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import org.kie.kogito.KogitoDrools;
import org.kie.kogito.KogitoGAV;
import org.kie.kogito.codegen.api.GeneratedFile;
import org.kie.kogito.codegen.api.Generator;
@@ -44,10 +48,27 @@
import org.kie.kogito.codegen.process.ProcessCodegen;
import org.kie.kogito.codegen.process.persistence.PersistenceGenerator;
import org.kie.kogito.codegen.rules.IncrementalRuleCodegen;
+import org.kie.kogito.dmn.KogitoDecisions;
import org.kie.kogito.maven.plugin.util.MojoUtil;
+import org.kie.kogito.pmml.KogitoPredictions;
+import org.kie.kogito.process.KogitoProcesses;
+import org.kie.kogito.serverless.workflow.KogitoServerlessWorkflow;
public abstract class AbstractKieMojo extends AbstractMojo {
+ protected static final Map> engineToRuntimeClass = new HashMap<>();
+
+ static {
+ engineToRuntimeClass.put(IncrementalRuleCodegen.GENERATOR_NAME,
+ Collections.singletonList(KogitoDrools.class.getCanonicalName()));
+ engineToRuntimeClass.put(ProcessCodegen.GENERATOR_NAME,
+ Arrays.asList(KogitoProcesses.class.getCanonicalName(), KogitoServerlessWorkflow.class.getCanonicalName()));
+ engineToRuntimeClass.put(PredictionCodegen.GENERATOR_NAME,
+ Collections.singletonList(KogitoPredictions.class.getCanonicalName()));
+ engineToRuntimeClass.put(DecisionCodegen.GENERATOR_NAME,
+ Collections.singletonList(KogitoDecisions.class.getCanonicalName()));
+ }
+
@Parameter(required = true, defaultValue = "${project.basedir}")
protected File projectDir;
@@ -67,7 +88,7 @@ public abstract class AbstractKieMojo extends AbstractMojo {
protected File generatedResources;
@Parameter(property = "kogito.codegen.persistence", defaultValue = "true")
- protected boolean persistence;
+ protected String generatePersistence;
@Parameter(property = "kogito.codegen.rules", defaultValue = "true")
protected String generateRules;
@@ -134,11 +155,32 @@ private void additionalProperties(KogitoBuildContext context) {
}
});
- context.setApplicationProperty(Generator.CONFIG_PREFIX + IncrementalRuleCodegen.GENERATOR_NAME, generateRules);
- context.setApplicationProperty(Generator.CONFIG_PREFIX + ProcessCodegen.GENERATOR_NAME, generateProcesses);
- context.setApplicationProperty(Generator.CONFIG_PREFIX + PredictionCodegen.GENERATOR_NAME, generatePredictions);
- context.setApplicationProperty(Generator.CONFIG_PREFIX + DecisionCodegen.GENERATOR_NAME, generateDecisions);
- context.setApplicationProperty(Generator.CONFIG_PREFIX + PersistenceGenerator.GENERATOR_NAME, persistence);
+ disableGeneratorIfNecessary(context, IncrementalRuleCodegen.GENERATOR_NAME, generateRules);
+ disableGeneratorIfNecessary(context, ProcessCodegen.GENERATOR_NAME, generateProcesses);
+ disableGeneratorIfNecessary(context, PredictionCodegen.GENERATOR_NAME, generatePredictions);
+ disableGeneratorIfNecessary(context, DecisionCodegen.GENERATOR_NAME, generateDecisions);
+ disableGeneratorIfNecessary(context, PersistenceGenerator.GENERATOR_NAME, generatePersistence);
+ }
+
+ /**
+ * A generator can be disabled explicitly with a property or if the corresponding runtime marker class is not available
+ */
+ private void disableGeneratorIfNecessary(KogitoBuildContext context, String generatorName, String enableProperty) {
+ if ("false".equalsIgnoreCase(enableProperty) || !engineToRuntimeClass.containsKey(generatorName)) {
+ context.setApplicationProperty(Generator.CONFIG_PREFIX + generatorName, enableProperty);
+ return;
+ }
+
+ Collection runtimeMarkerClasses = engineToRuntimeClass.get(generatorName);
+ for (String runtimeMarkerClass : runtimeMarkerClasses) {
+ if (context.hasClassAvailable(runtimeMarkerClass)) {
+ context.setApplicationProperty(Generator.CONFIG_PREFIX + generatorName, "true");
+ return;
+ }
+ }
+
+ getLog().info(String.format("Disabling '%s' generator because runtime classes not available (%s)", generatorName, String.join(",", runtimeMarkerClasses)));
+ context.setApplicationProperty(Generator.CONFIG_PREFIX + generatorName, "false");
}
private KogitoBuildContext.Builder contextBuilder() {
diff --git a/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/KogitoServerlessWorkflow.java b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/KogitoServerlessWorkflow.java
new file mode 100644
index 00000000000..7a4a21d1562
--- /dev/null
+++ b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/KogitoServerlessWorkflow.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2021 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.kie.kogito.serverless.workflow;
+
+/**
+ * Marker interface used to check SW engine availability
+ */
+public interface KogitoServerlessWorkflow {
+}