Commits

Meikel Brandmeyer committed c26b3e2

Replace sourceDir with sourceSet in ClojureCompileTask

Set the source set for the compile tasks in the ClojurePlugin

Fixes #2

  • Participants
  • Parent commits 175411c

Comments (0)

Files changed (2)

src/main/groovy/de/kotka/gradle/ClojureCompileTask.groovy

 import org.slf4j.LoggerFactory
 
 import java.io.File
+import java.util.Set
 
 public class ClojureCompileTask extends SourceTask {
     private static Logger logger = LoggerFactory.getLogger(ClojureCompileTask)
 
-    private File sourceDir
+    private ClojureSourceSet sourceSet
     private File destinationDir
     private FileCollection classpath
 
 
     private void initialise() {
         def action = [ execute: { ClojureCompileTask task ->
-            String sourceDir = task.sourceDir.path
+            Set<File> sourceDirs = task.sourceSet.srcDirs
             File destDir = task.destinationDir
             FileTree source = task.source
             FileCollection cp = task.classpath
             ]
 
             ant.path(id: 'compile.classpath') {
-                logger.debug("Add {} (source dir) to Ant classpath!", sourceDir)
-                pathelement(location: sourceDir)
+                sourceDirs.each {
+                    logger.debug("Add {} (source dir) to Ant classpath!", it)
+                    pathelement(location: it)
+                }
 
                 logger.debug("Add {} (dest dir) to Ant classpath!",
                     destDir.path)
         this.doLast(action)
     }
 
-    public File getSourceDir() {
-        return sourceDir
+    public ClojureSourceSet getSourceSet() {
+        return sourceSet
     }
 
-    public void setSourceDir(File dir) {
-        sourceDir = dir
+    public void setSourceSet(ClojureSourceSet set) {
+        sourceSet = set
     }
 
     public File getDestinationDir() {

src/main/groovy/de/kotka/gradle/ClojurePlugin.groovy

         String compileTaskName = sourceSet.getCompileTaskName("clojure")
         ClojureCompileTask task = project.tasks.add(compileTaskName,
                 ClojureCompileTask.class)
-        task.setSourceDir(new File(srcDir))
+        task.sourceSet = clojureSourceSet
         task.dependsOn(sourceSet.getCompileTaskName("java"))
         task.setDescription(String.format("Compile the %s Clojure source.",
                 sourceSet.name))