Search in sources :

Example 1 with NativeImageResourcePatternsBuildItem

use of io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem in project kogito-runtimes by kiegroup.

the class ProcessesAssetsProcessor method getGeneratedPersistenceFiles.

private Collection<GeneratedFile> getGeneratedPersistenceFiles(IndexView index, KogitoBuildContext context, BuildProducer<RunTimeConfigurationDefaultBuildItem> runTimeConfiguration, BuildProducer<NativeImageResourcePatternsBuildItem> resourcePatterns) {
    ClassInfo persistenceClass = index.getClassByName(persistenceFactoryClass);
    Collection<ClassInfo> modelClasses = index.getAllKnownImplementors(DotName.createSimple(Model.class.getCanonicalName()));
    JandexProtoGenerator protoGenerator = JandexProtoGenerator.builder(index).withPersistenceClass(persistenceClass).build(modelClasses);
    PersistenceGenerator persistenceGenerator = new PersistenceGenerator(context, protoGenerator, new JandexMarshallerGenerator(context, modelClasses));
    if (persistenceGenerator.persistenceType().equals(PersistenceGenerator.POSTGRESQL_PERSISTENCE_TYPE) || persistenceGenerator.persistenceType().equals(PersistenceGenerator.JDBC_PERSISTENCE_TYPE)) {
        resourcePatterns.produce(new NativeImageResourcePatternsBuildItem.Builder().includeGlob("sql/*.sql").build());
    } else if (persistenceGenerator.persistenceType().equals(PersistenceGenerator.KAFKA_PERSISTENCE_TYPE)) {
        String processIds = protoGenerator.getProcessIds().stream().map(s -> "kogito.process." + s).collect(joining(","));
        runTimeConfiguration.produce(new RunTimeConfigurationDefaultBuildItem(PersistenceGenerator.QUARKUS_KAFKA_STREAMS_TOPICS_PROP, processIds));
    }
    return persistenceGenerator.generate();
}
Also used : PersistenceGenerator(org.kie.kogito.codegen.process.persistence.PersistenceGenerator) NativeImageResourcePatternsBuildItem(io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem) RunTimeConfigurationDefaultBuildItem(io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem) ClassInfo(org.jboss.jandex.ClassInfo)

Aggregations

RunTimeConfigurationDefaultBuildItem (io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem)1 NativeImageResourcePatternsBuildItem (io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem)1 ClassInfo (org.jboss.jandex.ClassInfo)1 PersistenceGenerator (org.kie.kogito.codegen.process.persistence.PersistenceGenerator)1