Commits

Meikel Brandmeyer committed 773714e

Add clojureexec to project convetion

This completes javaexec style support for executing clojure functions.

Comments (0)

Files changed (2)

clojuresque/src/main/groovy/clojuresque/ClojureBasePlugin.groovy

         project.apply plugin: JavaPlugin.class
         project.apply plugin: MavenPlugin.class
 
-        project.convention.plugins.clojure = new ClojurePluginConvention()
+        project.convention.plugins.clojure =
+            new ClojurePluginConvention(project)
 
         RepositoryHandler repos = project.repositories
         repos.convention.plugins.clojure =

clojuresque/src/main/groovy/clojuresque/ClojurePluginConvention.groovy

 
 package clojuresque
 
+import org.gradle.api.Project
+import org.gradle.process.ExecResult
+import org.gradle.util.ConfigureUtil
+
+import groovy.lang.Closure
+
 class ClojurePluginConvention {
     def boolean warnOnReflection = false
     def boolean aotCompile = false
+    final Project project
+
+    public ClojurePluginConvention(Project project) {
+        this.project = project
+    }
+
+    public ExecResult clojureexec(Closure spec) {
+        ClojureExecAction action = ConfigureUtil.configure(spec,
+            new ClojureExecAction(project.fileResolver))
+        return action.execute()
+    }
 }