Meikel  Brandmeyer avatar Meikel Brandmeyer committed 24fb49e

Comments (0)

Files changed (3)

src/main/groovy/clojuresque/ClojureCompileTask.groovy

 
     private void initialise() {
         def action = [ execute: { ClojureCompileTask task ->
+            if (!task.project.aotCompile) {
+                return
+            }
+
             boolean warnOnReflection = task.project.warnOnReflection
             Set<File> sourceDirs = task.sourceSet.srcDirs
             File destDir = task.destinationDir

src/main/groovy/clojuresque/ClojurePlugin.groovy

 import org.gradle.api.plugins.JavaPluginConvention
 import org.gradle.api.plugins.ProjectPluginsContainer
 import org.gradle.api.tasks.ConventionValue
+import org.gradle.api.tasks.bundling.Jar
 
 public class ClojurePlugin implements Plugin {
     public void use(Project project, ProjectPluginsContainer handler) {
         configureCompileDefaults(project)
         configureSourceSetDefaults(project, javaPlugin)
         configureConfigurations(project)
+        configureArchives(project)
     }
 
     private JavaPluginConvention javaConvention(Convention convention) {
             clojuresque 'clojuresque:clojuresque:1.2.0-SNAPSHOT'
         }
     }
+
+    private void configureArchives(Project project) {
+        def action = [ execute: { Jar task ->
+            if (!task.project.aotCompile) {
+                task.from task.project.sourceSets[SourceSet.MAIN_SOURCE_SET_NAME].clojure
+            }
+        } ] as Action
+
+        project.tasks[JavaPlugin.JAR_TASK_NAME].doFirst(action)
+    }
 }
 

src/main/groovy/clojuresque/ClojurePluginConvention.groovy

 class ClojurePluginConvention {
     Project project
     boolean warnOnReflection
+    boolean aotCompile
 
     public ClojurePluginConvention(Project project) {
         this.project = project
         this.warnOnReflection = false
+        this.aotCompile = false
     }
 
     public void clojureSnapshotsRepo() {
     public void setWarnOnReflection(boolean flag) {
         this.warnOnReflection = flag
     }
+
+    public boolean getAotCompile() {
+        return this.aotCompile
+    }
+
+    public void setAotCompile(boolean flag) {
+        this.aotCompile = flag
+    }
 }
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.