Search in sources :

Example 1 with URLTemplate

use of io.micronaut.starter.template.URLTemplate in project micronaut-starter by micronaut-projects.

the class Maven method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    generatorContext.addTemplate("mavenWrapperJar", new BinaryTemplate(WRAPPER_JAR, classLoader.getResource("maven/" + WRAPPER_JAR)));
    generatorContext.addTemplate("mavenWrapperProperties", new URLTemplate(WRAPPER_PROPS, classLoader.getResource("maven/" + WRAPPER_PROPS)));
    generatorContext.addTemplate("mavenWrapperDownloader", new URLTemplate(WRAPPER_DOWNLOADER, classLoader.getResource("maven/" + WRAPPER_DOWNLOADER)));
    generatorContext.addTemplate("mavenWrapper", new URLTemplate("mvnw", classLoader.getResource("maven/mvnw"), true));
    generatorContext.addTemplate("mavenWrapperBat", new URLTemplate("mvnw.bat", classLoader.getResource("maven/mvnw.cmd"), true));
    generatorContext.addTemplate("mavenPom", new RockerTemplate("pom.xml", pom.template(generatorContext.getApplicationType(), generatorContext.getProject(), generatorContext.getFeatures(), generatorContext.getBuildProperties().getProperties())));
    generatorContext.addTemplate("gitignore", new RockerTemplate(".gitignore", gitignore.template()));
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) BinaryTemplate(io.micronaut.starter.template.BinaryTemplate) URLTemplate(io.micronaut.starter.template.URLTemplate)

Example 2 with URLTemplate

use of io.micronaut.starter.template.URLTemplate in project micronaut-starter by micronaut-projects.

the class Gradle method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    generatorContext.addTemplate("gradleWrapperJar", new BinaryTemplate(WRAPPER_JAR, classLoader.getResource(WRAPPER_JAR)));
    generatorContext.addTemplate("gradleWrapperProperties", new URLTemplate(WRAPPER_PROPS, classLoader.getResource(WRAPPER_PROPS)));
    generatorContext.addTemplate("gradleWrapper", new URLTemplate("gradlew", classLoader.getResource("gradle/gradlew"), true));
    generatorContext.addTemplate("gradleWrapperBat", new URLTemplate("gradlew.bat", classLoader.getResource("gradle/gradlew.bat"), true));
    BuildTool buildTool = generatorContext.getBuildTool();
    generatorContext.addTemplate("build", new RockerTemplate(buildTool.getBuildFileName(), buildGradle.template(generatorContext.getApplicationType(), generatorContext.getProject(), generatorContext.getFeatures(), buildTool == BuildTool.GRADLE_KOTLIN)));
    generatorContext.addTemplate("gitignore", new RockerTemplate(".gitignore", gitignore.template()));
    generatorContext.addTemplate("projectProperties", new RockerTemplate("gradle.properties", gradleProperties.template(generatorContext.getBuildProperties().getProperties())));
    String settingsFile = buildTool == BuildTool.GRADLE ? "settings.gradle" : "settings.gradle.kts";
    generatorContext.addTemplate("gradleSettings", new RockerTemplate(settingsFile, settingsGradle.template(generatorContext.getProject())));
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) BinaryTemplate(io.micronaut.starter.template.BinaryTemplate) URLTemplate(io.micronaut.starter.template.URLTemplate) BuildTool(io.micronaut.starter.options.BuildTool)

Example 3 with URLTemplate

use of io.micronaut.starter.template.URLTemplate in project micronaut-starter by micronaut-projects.

the class KoTest method doApply.

@Override
public void doApply(GeneratorContext generatorContext) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    generatorContext.addTemplate("koTestConfig", new URLTemplate("src/test/kotlin/io/kotest/provided/ProjectConfig.kt", classLoader.getResource("kotest/ProjectConfig.kt")));
}
Also used : URLTemplate(io.micronaut.starter.template.URLTemplate)

Example 4 with URLTemplate

use of io.micronaut.starter.template.URLTemplate in project micronaut-starter by micronaut-projects.

the class AbstractAzureFunction method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    ApplicationType type = generatorContext.getApplicationType();
    generatorContext.addTemplate("host.json", new URLTemplate("host.json", classLoader.getResource("functions/azure/host.json")));
    generatorContext.addTemplate("local.settings.json", new URLTemplate("local.settings.json", classLoader.getResource("functions/azure/local.settings.json")));
    BuildTool buildTool = generatorContext.getBuildTool();
    Project project = generatorContext.getProject();
    if (buildTool == BuildTool.MAVEN) {
        BuildProperties props = generatorContext.getBuildProperties();
        props.put("functionAppName", project.getName());
        props.put("functionAppRegion", "westus");
        props.put("functionResourceGroup", "java-functions-group");
        props.put("stagingDirectory", "${project.build.directory}/azure-functions/${functionAppName}");
    }
    addFunctionTemplate(generatorContext, project);
    applyFunction(generatorContext, type);
}
Also used : ApplicationType(io.micronaut.starter.application.ApplicationType) Project(io.micronaut.starter.application.Project) URLTemplate(io.micronaut.starter.template.URLTemplate) BuildProperties(io.micronaut.starter.build.BuildProperties) BuildTool(io.micronaut.starter.options.BuildTool)

Aggregations

URLTemplate (io.micronaut.starter.template.URLTemplate)4 BuildTool (io.micronaut.starter.options.BuildTool)2 BinaryTemplate (io.micronaut.starter.template.BinaryTemplate)2 RockerTemplate (io.micronaut.starter.template.RockerTemplate)2 ApplicationType (io.micronaut.starter.application.ApplicationType)1 Project (io.micronaut.starter.application.Project)1 BuildProperties (io.micronaut.starter.build.BuildProperties)1