Search in sources :

Example 1 with DeployConfigMapTask

use of org.curioswitch.gradle.plugins.curioserver.tasks.DeployConfigMapTask in project curiostack by curioswitch.

the class CurioServerPlugin method apply.

@Override
public void apply(Project project) {
    project.getPluginManager().apply(ApplicationPlugin.class);
    project.getPluginManager().apply(GitPropertiesPlugin.class);
    project.getExtensions().create(ImmutableDeploymentExtension.NAME, DeploymentExtension.class, project);
    project.getNormalization().getRuntimeClasspath().ignore("git.properties");
    project.afterEvaluate(p -> {
        ImmutableDeploymentExtension config = project.getExtensions().getByType(DeploymentExtension.class);
        String archivesBaseName = project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
        project.getConvention().getPlugin(ApplicationPluginConvention.class).setApplicationName(archivesBaseName);
        GroovyObject docker = project.getExtensions().getByType(DockerExtension.class);
        DockerJavaApplication javaApplication = (DockerJavaApplication) docker.getProperty("javaApplication");
        javaApplication.setBaseImage("openjdk:9-jre-slim");
        project.getTasks().getByName("build").dependsOn("dockerDistTar");
        for (ImmutableDeploymentConfiguration type : config.getTypes()) {
            String capitalized = Ascii.toUpperCase(type.getName().charAt(0)) + type.getName().substring(1);
            DeployConfigMapTask deployConfigMapTask = project.getTasks().create("deployConfigMap" + capitalized, DeployConfigMapTask.class).setType(type.getName());
            project.getTasks().create("deploy" + capitalized, DeployPodTask.class).setType(type.getName()).dependsOn(deployConfigMapTask);
        }
    });
    project.getPluginManager().apply(DockerJavaApplicationPlugin.class);
}
Also used : BasePluginConvention(org.gradle.api.plugins.BasePluginConvention) DockerJavaApplication(com.bmuschko.gradle.docker.DockerJavaApplication) DeployConfigMapTask(org.curioswitch.gradle.plugins.curioserver.tasks.DeployConfigMapTask) ApplicationPluginConvention(org.gradle.api.plugins.ApplicationPluginConvention) ImmutableDeploymentConfiguration(org.curioswitch.gradle.plugins.curioserver.ImmutableDeploymentExtension.ImmutableDeploymentConfiguration) GroovyObject(groovy.lang.GroovyObject)

Aggregations

DockerJavaApplication (com.bmuschko.gradle.docker.DockerJavaApplication)1 GroovyObject (groovy.lang.GroovyObject)1 ImmutableDeploymentConfiguration (org.curioswitch.gradle.plugins.curioserver.ImmutableDeploymentExtension.ImmutableDeploymentConfiguration)1 DeployConfigMapTask (org.curioswitch.gradle.plugins.curioserver.tasks.DeployConfigMapTask)1 ApplicationPluginConvention (org.gradle.api.plugins.ApplicationPluginConvention)1 BasePluginConvention (org.gradle.api.plugins.BasePluginConvention)1