Search in sources :

Example 1 with ApplicationType

use of io.micronaut.starter.application.ApplicationType in project micronaut-starter by micronaut-projects.

the class AwsLambdaCustomRuntime method apply.

@SuppressWarnings("EmptyBlock")
@Override
public void apply(GeneratorContext generatorContext) {
    ApplicationFeature.super.apply(generatorContext);
    ApplicationType applicationType = generatorContext.getApplicationType();
    Project project = generatorContext.getProject();
    if (shouldGenerateMainClassForRuntime(generatorContext)) {
        addBookLambdaRuntime(generatorContext, project);
    }
    addBootstrap(generatorContext, applicationType);
}
Also used : ApplicationType(io.micronaut.starter.application.ApplicationType) Project(io.micronaut.starter.application.Project)

Example 2 with ApplicationType

use of io.micronaut.starter.application.ApplicationType in project micronaut-starter by micronaut-projects.

the class FeatureDiffCommand method call.

@Override
public Integer call() throws Exception {
    String appName = FileSystemOutputHandler.getDefaultBaseDirectory().getName();
    Project project = NameUtils.parse(config.getDefaultPackage() + "." + appName);
    Options options = new Options(config.getSourceLanguage(), config.getTestFramework(), config.getBuildTool());
    ApplicationType applicationType = config.getApplicationType();
    List<String> features = this.features;
    ProjectGenerator projectGenerator = this.projectGenerator;
    featureDiffer.produceDiff(projectGenerator, project, applicationType, options, getOperatingSystem(), features, this);
    return 0;
}
Also used : Project(io.micronaut.starter.application.Project) Options(io.micronaut.starter.options.Options) ApplicationType(io.micronaut.starter.application.ApplicationType) ProjectGenerator(io.micronaut.starter.application.generator.ProjectGenerator)

Example 3 with ApplicationType

use of io.micronaut.starter.application.ApplicationType in project micronaut-starter by micronaut-projects.

the class AwsLambda method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    Project project = generatorContext.getProject();
    if (shouldGenerateSources(generatorContext)) {
        addBook(generatorContext, project);
        addBookSaved(generatorContext, project);
        ApplicationType applicationType = generatorContext.getApplicationType();
        if (applicationType == DEFAULT || applicationType == FUNCTION) {
            if (applicationType == DEFAULT) {
                addBookController(generatorContext, project);
                addBookControllerTest(generatorContext, project);
            } else {
                addRequestHandler(generatorContext, project);
                addTest(generatorContext, project);
            }
            DocumentationLink link = new DocumentationLink(LINK_TITLE, LINK_URL);
            generatorContext.addHelpTemplate(new RockerWritable(readmeRockerModel(this, generatorContext, link)));
        }
    }
}
Also used : Project(io.micronaut.starter.application.Project) ApplicationType(io.micronaut.starter.application.ApplicationType) RockerWritable(io.micronaut.starter.template.RockerWritable) DocumentationLink(io.micronaut.starter.feature.function.DocumentationLink)

Example 4 with ApplicationType

use of io.micronaut.starter.application.ApplicationType in project micronaut-starter by micronaut-projects.

the class OracleRawFunction method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    ApplicationType type = generatorContext.getApplicationType();
    if (type == ApplicationType.FUNCTION) {
        applyFunction(generatorContext, type);
        Language language = generatorContext.getLanguage();
        Project project = generatorContext.getProject();
        String sourceFile = generatorContext.getSourcePath("/{packagePath}/Function");
        switch(language) {
            case GROOVY:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionGroovy.template(project)));
                break;
            case KOTLIN:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionKotlin.template(project)));
                break;
            case JAVA:
            default:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, oracleRawFunctionJava.template(project)));
        }
        applyTestTemplate(generatorContext, project, "Function");
    }
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) ApplicationType(io.micronaut.starter.application.ApplicationType) Project(io.micronaut.starter.application.Project) Language(io.micronaut.starter.options.Language)

Example 5 with ApplicationType

use of io.micronaut.starter.application.ApplicationType in project micronaut-starter by micronaut-projects.

the class GoogleCloudRawFunction method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    ApplicationType type = generatorContext.getApplicationType();
    applyFunction(generatorContext, type);
    if (type == ApplicationType.FUNCTION) {
        Language language = generatorContext.getLanguage();
        Project project = generatorContext.getProject();
        String sourceFile = generatorContext.getSourcePath("/{packagePath}/Function");
        switch(language) {
            case GROOVY:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionGroovy.template(project)));
                break;
            case KOTLIN:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionKotlin.template(project)));
                break;
            case JAVA:
            default:
                generatorContext.addTemplate("function", new RockerTemplate(sourceFile, gcpRawBackgroundFunctionJava.template(project)));
        }
        applyTestTemplate(generatorContext, project, "Function");
    }
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) ApplicationType(io.micronaut.starter.application.ApplicationType) Project(io.micronaut.starter.application.Project) Language(io.micronaut.starter.options.Language)

Aggregations

ApplicationType (io.micronaut.starter.application.ApplicationType)7 Project (io.micronaut.starter.application.Project)7 Language (io.micronaut.starter.options.Language)2 Options (io.micronaut.starter.options.Options)2 RockerTemplate (io.micronaut.starter.template.RockerTemplate)2 ProjectGenerator (io.micronaut.starter.application.generator.ProjectGenerator)1 BuildProperties (io.micronaut.starter.build.BuildProperties)1 DocumentationLink (io.micronaut.starter.feature.function.DocumentationLink)1 MapOutputHandler (io.micronaut.starter.io.MapOutputHandler)1 BuildTool (io.micronaut.starter.options.BuildTool)1 RockerWritable (io.micronaut.starter.template.RockerWritable)1 URLTemplate (io.micronaut.starter.template.URLTemplate)1 Map (java.util.Map)1