From 00b83f113bbf286d145b2a7037afd4c28ed11ee8 Mon Sep 17 00:00:00 2001
From: Mark Perry <maperry78@yahoo.com.au>
Date: Wed, 11 Feb 2015 02:27:08 +1000
Subject: Improve task options

---
 src/main/groovy/org/gradle/frege/FregeTask.groovy | 59 ++++++++++++++---------
 1 file changed, 37 insertions(+), 22 deletions(-)

(limited to 'src/main')

diff --git a/src/main/groovy/org/gradle/frege/FregeTask.groovy b/src/main/groovy/org/gradle/frege/FregeTask.groovy
index 6dffb95..c0f898e 100644
--- a/src/main/groovy/org/gradle/frege/FregeTask.groovy
+++ b/src/main/groovy/org/gradle/frege/FregeTask.groovy
@@ -12,27 +12,36 @@ class FregeTask extends DefaultTask {
 
     private static final FREGE_FILE_EXTENSION_PATTERN = ~/.*\.fr?$/
 
+    static String DEFAULT_CLASSES_DIR = "build/classes/main"
+    static String DEFAULT_SRC_DIR = "src/main/frege"
+
     @Input
-    boolean hints
+    boolean hints = false
 
     @Input
-    boolean verbose
+    boolean verbose = false
 
     @Input
-    boolean inline = true
+    boolean inline = false
 
     @Input
     boolean make = true
 
     @Input
-    boolean skipCompile
+    boolean skipCompile = false
 
     @Input
     boolean includeStale
 
+    @Input
+    String extraArgs = ""
+
+    @Input
+    String allArgs = ""
+
     // TODO: Find default
     @OutputDirectory
-    File outputDir = new File("build/classes/main")
+    File outputDir = new File(DEFAULT_CLASSES_DIR)
 
     @TaskAction
     void executeCompile() {
@@ -45,26 +54,32 @@ class FregeTask extends DefaultTask {
         action.setClasspath(project.files(project.configurations.compile))
 
         List args = []
-        if (hints)
-            args << "-hints"
-        if (inline)
-            args << "-inline"
-        if (make)
-            args << "-make"
-        if (verbose)
-            args << "-v"
-        if (skipCompile)
-            args << "-j"
-
-        args << "-d"
-        args << outputDir
-
-
-        eachFileRecurse(new File("src/main/frege")) { File file ->
+
+        if (allArgs != "") {
+            args = allArgs.split().toList()
+        } else {
+
+            if (hints)
+                args << "-hints"
+            if (inline)
+                args << "-inline"
+            if (make)
+                args << "-make"
+            if (verbose)
+                args << "-v"
+            if (skipCompile)
+                args << "-j"
+
+            args << "-d"
+            args << outputDir
+
+            args = args + extraArgs.split().toList()
+        }
+
+        eachFileRecurse(new File(DEFAULT_SRC_DIR)) { File file ->
             if (file.name =~ FREGE_FILE_EXTENSION_PATTERN) {
                 args << file
             }
-
         }
 
         println("FregeTask args: $args")
-- 
cgit