Commits

David Carr  committed 009d99c

LessPlugin: add less compilation to buildSite dependencies rather than publishSite

  • Participants
  • Parent commits 5c2273a

Comments (0)

Files changed (2)

File src/main/java/us/carrclan/david/gradle/less/LessPlugin.java

 import org.gradle.api.Project;
 import org.gradle.api.internal.ConventionMapping;
 import org.gradle.api.internal.IConventionAware;
-import us.carrclan.david.gradle.site.PublishSite;
 import us.carrclan.david.gradle.site.SiteExtension;
 import us.carrclan.david.gradle.site.SitePlugin;
 
             public void execute(SitePlugin plugin) {
                 LessCompile lessCompileSite = configureSiteTask();
                 configureSiteTaskDefaults(lessCompileSite);
-                configurePublishSiteDependencies();
+                configureBuildSiteDependencies();
             }
         });
     }
         });
     }
 
-    private void configurePublishSiteDependencies() {
-        project.getTasks().withType(PublishSite.class, new Action<PublishSite>() {
-            public void execute(PublishSite task) {
-                task.dependsOn(LESS_COMPILE_SITE_TASK_NAME);
-            }
-        });
+    private void configureBuildSiteDependencies() {
+        project.getTasks().getByName(SitePlugin.BUILD_SITE_TASK_NAME).dependsOn(LESS_COMPILE_SITE_TASK_NAME);
     }
 
     private ConventionMapping conventionMapping(Object conventionAware) {

File src/test/groovy/us/carrclan/david/gradle/less/LessPluginSpec.groovy

 package us.carrclan.david.gradle.less
 
 import org.gradle.api.Project
+import org.gradle.api.Task
 import org.gradle.testfixtures.ProjectBuilder
 import spock.lang.Specification
-import us.carrclan.david.gradle.site.PublishSite
 import us.carrclan.david.gradle.site.SitePlugin
 
 class LessPluginSpec extends Specification {
         project.tasks.getByName('lessCompileSite') instanceof LessCompile
         lessCompileSiteTask.description == 'Compiles the site LESS files to CSS.'
         lessCompileSiteTask.group == null
-        'lessCompileSite' in publishSiteTask.dependsOn
+        'lessCompileSite' in buildSiteTask.dependsOn
         lessCompileSiteTask.sourceDir == project.file('src/site/less')
         lessCompileSiteTask.destinationDir == project.file('build/resources/site/css')
         lessCompileSiteTask.compress == null
         return project.tasks.getByName('lessCompileSite') as LessCompile
     }
 
-    private PublishSite getPublishSiteTask() {
-        return project.tasks.getByName('publishSite') as PublishSite
+    private Task getBuildSiteTask() {
+        return project.tasks.getByName('buildSite')
     }
 }