use of io.automatiko.engine.codegen.di.CDIDependencyInjectionAnnotator 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.di.CDIDependencyInjectionAnnotator in project automatiko-engine by automatiko-io.
the class AutomatikoCompilationProvider method compile.
@Override
public final void compile(Set<File> filesToCompile, Context context) {
Set<File> allFiles = AutomatikoBuildData.get().getGenerationContext().collectConnectedFiles(filterFilesToCompile(filesToCompile));
if (allFiles.isEmpty()) {
return;
}
File outputDirectory = AutomatikoBuildData.get().getGenerationContext().getClassesPath();
try {
ApplicationGenerator appGen = new ApplicationGenerator(AutomatikoBuildData.get().getConfig().packageName().orElse(AutomatikoQuarkusProcessor.DEFAULT_PACKAGE_NAME), outputDirectory).withDependencyInjection(new CDIDependencyInjectionAnnotator()).withGeneratorContext(AutomatikoBuildData.get().getGenerationContext());
addGenerator(appGen, allFiles, context);
Collection<GeneratedFile> generatedFiles = appGen.generate();
Set<File> generatedSourceFiles = new HashSet<>();
for (GeneratedFile file : generatedFiles) {
Path path = pathOf(outputDirectory.getPath(), file.relativePath());
if (file.getType() != GeneratedFile.Type.APPLICATION && file.getType() != GeneratedFile.Type.APPLICATION_CONFIG) {
Files.write(path, file.contents());
generatedSourceFiles.add(path.toFile());
}
}
javaCompile(generatedSourceFiles, context, outputDirectory);
} catch (IOException e) {
throw new AutomatikoCompilerException(e);
}
}
Aggregations