package io.freefair.gradle.plugins;

import org.gradle.api.Plugin;
import org.gradle.api.Project;

/**
 * @author Lars Grefer
 */
public class JSassPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {

    }
}

@@ -95,149 +95,2181 @@
 ct;%0A
-%0A/**%0A * @author Lars Grefer%0A */%0Apublic class JSassPlugin implements Plugin%3CProject%3E %7B%0A    @Override%0A    public void apply(Project project) %7B%0A
+import org.gradle.api.plugins.JavaPluginConvention;%0Aimport org.gradle.api.plugins.WarPlugin;%0Aimport org.gradle.api.plugins.WarPluginConvention;%0Aimport org.gradle.api.tasks.Copy;%0Aimport org.gradle.api.tasks.bundling.War;%0A%0Aimport java.io.File;%0Aimport java.util.Set;%0A%0A/**%0A * @author Lars Grefer%0A */%0Apublic class JSassPlugin implements Plugin%3CProject%3E %7B%0A    @Override%0A    public void apply(Project project) %7B%0A        project.getPluginManager().withPlugin(%22java%22, appliedPlugin -%3E applyForJava(project));%0A%0A        project.getPluginManager().withPlugin(%22war%22, appliedPlugin -%3E applyForWar(project));%0A    %7D%0A%0A    private void applyForWar(Project project) %7B%0A        WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class);%0A%0A        CompileSass compileWebappSass = project.getTasks().create(%22compileWebappSass%22, CompileSass.class);%0A%0A        compileWebappSass.setSourceDir(warPluginConvention.getWebAppDir());%0A        compileWebappSass.setDestinationDir(warPluginConvention.getWebAppDir());%0A%0A        War war = (War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);%0A%0A        war.dependsOn(compileWebappSass);%0A    %7D%0A%0A    private void applyForJava(Project project) %7B%0A        project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -%3E %7B%0A            String taskName = sourceSet.getTaskName(%22compile%22, %22Sass%22);%0A%0A            Set%3CFile%3E srcDirs = sourceSet.getResources().getSrcDirs();%0A%0A            int i = 1;%0A            for (File srcDir : srcDirs) %7B%0A                CompileSass compileSass = project.getTasks().create(i == 1 ? taskName : taskName + i, CompileSass.class);%0A                i++;%0A%0A                compileSass.setSourceDir(srcDir);%0A%0A                Copy processResources = (Copy) project.getTasks().getByName(sourceSet.getProcessResourcesTaskName());%0A                compileSass.setDestinationDir(processResources.getDestinationDir());%0A%0A                compileSass.setGroup(%22build%22);%0A                compileSass.setDescription(%22Compile sass and scss files for the %22 + sourceSet.getName() + %22 source set%22);%0A%0A                processResources.dependsOn(compileSass);%0A            %7D%0A%0A        %7D);
 %0A   

add default configs