use of io.automatiko.engine.codegen.GeneratorContext in project automatiko-engine by automatiko-io.
the class AutomatikoQuarkusProcessor method createApplicationGenerator.
private ApplicationGenerator createApplicationGenerator(AutomatikoBuildTimeConfig config, AppPaths appPaths, CompositeIndex archivesIndex, ApplicationModel appModel) throws IOException {
boolean usePersistence = archivesIndex.getClassByName(createDotName(persistenceFactoryClass)) != null;
GeneratorContext context = buildContext(config, appPaths, archivesIndex);
ApplicationGenerator appGen = new ApplicationGenerator(config.packageName().orElse(DEFAULT_PACKAGE_NAME), new File(appPaths.getFirstProjectPath().toFile(), "target")).withDependencyInjection(new CDIDependencyInjectionAnnotator()).withPersistence(usePersistence).withGeneratorContext(context);
List<String> dependencies = new ArrayList<>();
if (appModel != null) {
for (ResolvedDependency i : appModel.getRuntimeDependencies()) {
dependencies.add(i.getResolvedPaths().getSinglePath().toAbsolutePath().toString());
}
}
addProcessGenerator(appPaths, usePersistence, appGen, dependencies);
if (context.getBuildContext().isDmnSupported()) {
addDecisionGenerator(appPaths, appGen, false, dependencies);
}
return appGen;
}
use of io.automatiko.engine.codegen.GeneratorContext in project automatiko-engine by automatiko-io.
the class AutomatikoQuarkusProcessor method buildContext.
private GeneratorContext buildContext(AutomatikoBuildTimeConfig config, AppPaths appPaths, IndexView index) {
GeneratorContext generationContext = QuarkusGeneratorContext.ofResourcePath(appPaths.getResourceFiles()[0], appPaths.getFirstClassesPath().toFile());
generationContext.withBuildContext(new QuarkusApplicationBuildContext(config, className -> {
DotName classDotName = createDotName(className);
return !index.getAnnotations(classDotName).isEmpty() || index.getClassByName(classDotName) != null;
}, className -> {
return index.getAllKnownImplementors(createDotName(className)).stream().map(c -> c.name().toString()).collect(Collectors.toList());
}));
return AutomatikoBuildData.create(config, generationContext).getGenerationContext();
}
Aggregations