Commits

Meikel Brandmeyer committed c26b3e2

Replace sourceDir with sourceSet in ClojureCompileTask

Set the source set for the compile tasks in the ClojurePlugin

Fixes #2

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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.