From c7488f8e4214f408847b04768e54ef895c78dcff Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Fri, 12 Nov 2021 15:59:10 +0100 Subject: [PATCH 1/3] fix: add `provided` dependency to `quarkus-jackson` --- .../kogito-quarkus-common/pom.xml | 6 ++++++ .../kogito-quarkus-rules/pom.xml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/pom.xml b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/pom.xml index 68a2e6ca4d0..c42f70b770b 100644 --- a/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/pom.xml +++ b/quarkus/extensions/kogito-quarkus-extension-common/kogito-quarkus-common/pom.xml @@ -55,6 +55,12 @@ provided + + io.quarkus + quarkus-jackson + provided + + io.quarkus quarkus-arc diff --git a/quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules/pom.xml b/quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules/pom.xml index 6a4e32a921a..4baf38d3ea3 100644 --- a/quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules/pom.xml +++ b/quarkus/extensions/kogito-quarkus-rules-extension/kogito-quarkus-rules/pom.xml @@ -24,6 +24,11 @@ org.kie.kogito kogito-api-incubation-rules-services + + io.quarkus + quarkus-jackson + provided + From 90fe0ad2abe2b5d3bae96ff130fa9ec108997b1d Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Mon, 15 Nov 2021 14:37:57 +0100 Subject: [PATCH 2/3] ObjectMapperGenerator should be optional (generate only with resteasy present) --- .../kie/kogito/codegen/core/ApplicationConfigGenerator.java | 2 +- .../org/kie/kogito/codegen/core/ObjectMapperGenerator.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ApplicationConfigGenerator.java b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ApplicationConfigGenerator.java index d90aecaeb60..13cc45a11f7 100644 --- a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ApplicationConfigGenerator.java +++ b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ApplicationConfigGenerator.java @@ -74,7 +74,7 @@ public Collection generate() { generatedFiles.add(generateApplicationConfigDescriptor(configClassNames)); - if (context.hasDI()) { + if (context.hasDI() && context.hasRESTGloballyAvailable()) { generatedFiles.add(ObjectMapperGenerator.generate(context)); } diff --git a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java index b496679da1d..c120a99ee44 100644 --- a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java +++ b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java @@ -17,6 +17,7 @@ import org.kie.kogito.codegen.api.GeneratedFile; import org.kie.kogito.codegen.api.GeneratedFileType; +import org.kie.kogito.codegen.api.Generator; import org.kie.kogito.codegen.api.context.KogitoBuildContext; import org.kie.kogito.codegen.api.template.TemplatedGenerator; @@ -25,14 +26,12 @@ public class ObjectMapperGenerator { private ObjectMapperGenerator() { } - private static final GeneratedFileType JSON_MAPPER_TYPE = GeneratedFileType.of("JSON_MAPPER", GeneratedFileType.Category.SOURCE); - public static GeneratedFile generate(KogitoBuildContext context) { TemplatedGenerator generator = TemplatedGenerator.builder() .withTemplateBasePath("class-templates/config") .build(context, "GlobalObjectMapper"); - return new GeneratedFile(JSON_MAPPER_TYPE, + return new GeneratedFile(Generator.REST_TYPE, generator.generatedFilePath(), generator.compilationUnitOrThrow().toString()); } From ad9a3a0b5e864626c1b44d26728cd10da9e004b6 Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Tue, 16 Nov 2021 09:45:11 +0100 Subject: [PATCH 3/3] formatting --- .../java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java index c120a99ee44..cf09d3a2108 100644 --- a/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java +++ b/kogito-codegen-modules/kogito-codegen-core/src/main/java/org/kie/kogito/codegen/core/ObjectMapperGenerator.java @@ -16,7 +16,6 @@ package org.kie.kogito.codegen.core; import org.kie.kogito.codegen.api.GeneratedFile; -import org.kie.kogito.codegen.api.GeneratedFileType; import org.kie.kogito.codegen.api.Generator; import org.kie.kogito.codegen.api.context.KogitoBuildContext; import org.kie.kogito.codegen.api.template.TemplatedGenerator;