use of org.kie.kogito.codegen.api.context.KogitoBuildContext 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");
}
use of org.kie.kogito.codegen.api.context.KogitoBuildContext 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();
}
use of org.kie.kogito.codegen.api.context.KogitoBuildContext in project kogito-runtimes by kiegroup.
the class KogitoAssetsProcessor method generateModel.
@BuildStep
public List<KogitoGeneratedClassesBuildItem> generateModel(KogitoGeneratedSourcesBuildItem sources, List<KogitoAddonsGeneratedSourcesBuildItem> extraSources, KogitoBuildContextBuildItem contextBuildItem, BuildProducer<GeneratedBeanBuildItem> generatedBeans, BuildProducer<GeneratedJaxRsResourceBuildItem> jaxrsProducer, BuildProducer<AdditionalStaticResourceBuildItem> staticResProducer, BuildProducer<NativeImageResourceBuildItem> resource, BuildProducer<ReflectiveClassBuildItem> reflectiveClass, BuildProducer<GeneratedResourceBuildItem> genResBI) throws IOException {
final KogitoBuildContext context = contextBuildItem.getKogitoBuildContext();
Collection<GeneratedFile> generatedFiles = collectGeneratedFiles(sources, extraSources);
// dump files to disk
dumpFilesToDisk(context.getAppPaths(), generatedFiles);
// build Java source code and register the generated beans
Optional<KogitoGeneratedClassesBuildItem> optionalIndex = compileAndIndexJavaSources(context, generatedFiles, generatedBeans, jaxrsProducer, liveReload.isLiveReload());
registerDataEventsForReflection(optionalIndex.map(KogitoGeneratedClassesBuildItem::getIndexedClasses), context, reflectiveClass);
registerKogitoIncubationAPI(reflectiveClass);
registerResources(generatedFiles, staticResProducer, resource, genResBI);
return optionalIndex.map(Collections::singletonList).orElse(Collections.emptyList());
}
Aggregations