Search in sources :

Example 1 with CodeGenerator

use of ilargia.entitas.codeGeneration.CodeGenerator in project Entitas-Java by Rubentxu.

the class CodeGenerationTask method run.

@TaskAction
public void run() {
    entitasProject = new EntitasGradleProject(getProject());
    CodeGenerator codeGenerator = entitasProject.getCodeGenerator();
    codeGenerator.generate();
}
Also used : CodeGenerator(ilargia.entitas.codeGeneration.CodeGenerator) TaskAction(org.gradle.api.tasks.TaskAction)

Example 2 with CodeGenerator

use of ilargia.entitas.codeGeneration.CodeGenerator in project Entitas-Java by Rubentxu.

the class EntitasGradleProject method getCodeGenerator.

@Override
public CodeGenerator getCodeGenerator() {
    Properties properties = loadProperties();
    CodeGeneratorConfig config = new CodeGeneratorConfig();
    config.configure(properties);
    List<Class> types = loadTypesFromPlugins(properties);
    List<ICodeGeneratorDataProvider> dataProviders = getEnabledInstances(types, config.getDataProviders(), ICodeGeneratorDataProvider.class);
    List<ICodeGenerator> codeGenerators = getEnabledInstances(types, config.getCodeGenerators(), ICodeGenerator.class);
    List<ICodeGenFilePostProcessor> postProcessors = getEnabledInstances(types, config.getPostProcessors(), ICodeGenFilePostProcessor.class);
    configure(dataProviders, properties);
    configure(codeGenerators, properties);
    configure(postProcessors, properties);
    return new CodeGenerator(dataProviders, codeGenerators, postProcessors);
}
Also used : CodeGeneratorConfig(ilargia.entitas.codeGeneration.config.CodeGeneratorConfig) ICodeGenerator(ilargia.entitas.codeGeneration.interfaces.ICodeGenerator) ICodeGeneratorDataProvider(ilargia.entitas.codeGeneration.interfaces.ICodeGeneratorDataProvider) ICodeGenFilePostProcessor(ilargia.entitas.codeGeneration.interfaces.ICodeGenFilePostProcessor) CodeGenerator(ilargia.entitas.codeGeneration.CodeGenerator) ICodeGenerator(ilargia.entitas.codeGeneration.interfaces.ICodeGenerator) Properties(java.util.Properties)

Example 3 with CodeGenerator

use of ilargia.entitas.codeGeneration.CodeGenerator in project Entitas-Java by Rubentxu.

the class DryRun method run.

@Override
public void run(String[] args) {
    System.out.println("Entitas Code Generator version " + 1);
    if (assertProperties()) {
        //CodeGeneratorUtil.codeGeneratorFromProperties();
        CodeGenerator codeGenerator = null;
        codeGenerator.OnProgress = (title, info, progress) -> {
            int p = (int) (progress * 100);
            System.out.println(String.format("{0}: {1} ({2}%)", title, info, p));
        };
        codeGenerator.dryRun();
    }
}
Also used : CodeGenerator(ilargia.entitas.codeGeneration.CodeGenerator)

Example 4 with CodeGenerator

use of ilargia.entitas.codeGeneration.CodeGenerator in project Entitas-Java by Rubentxu.

the class Generate method run.

@Override
public void run(String[] args) {
    System.out.println("Entitas Code Generator version " + 1);
    if (assertProperties()) {
        //CodeGeneratorUtil.codeGeneratorFromProperties();
        CodeGenerator codeGenerator = null;
        codeGenerator.OnProgress = (title, info, progress) -> {
            int p = (int) (progress * 100);
            System.out.println(String.format("{0}: {1} ({2}%)", title, info, p));
        };
        codeGenerator.generate();
    }
}
Also used : CodeGenerator(ilargia.entitas.codeGeneration.CodeGenerator)

Aggregations

CodeGenerator (ilargia.entitas.codeGeneration.CodeGenerator)4 CodeGeneratorConfig (ilargia.entitas.codeGeneration.config.CodeGeneratorConfig)1 ICodeGenFilePostProcessor (ilargia.entitas.codeGeneration.interfaces.ICodeGenFilePostProcessor)1 ICodeGenerator (ilargia.entitas.codeGeneration.interfaces.ICodeGenerator)1 ICodeGeneratorDataProvider (ilargia.entitas.codeGeneration.interfaces.ICodeGeneratorDataProvider)1 Properties (java.util.Properties)1 TaskAction (org.gradle.api.tasks.TaskAction)1