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();
}
Aggregations