summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMark Perry <mark.perry@revelian.com>2015-02-06 12:46:53 +1000
committerMark Perry <mark.perry@revelian.com>2015-02-06 12:46:53 +1000
commit34560bfe5ed4131b3403c6643bc32b4d3688e5e1 (patch)
tree36a2e06665cd3e565b0e9d6f15e9b4a32897be11 /src/main
parent16088a0224051cb6bc494d8706e43bf55399b012 (diff)
downloadfrege-gradle-plugin-34560bfe5ed4131b3403c6643bc32b4d3688e5e1.tar.gz
frege-gradle-plugin-34560bfe5ed4131b3403c6643bc32b4d3688e5e1.tar.bz2
frege-gradle-plugin-34560bfe5ed4131b3403c6643bc32b4d3688e5e1.zip
Auto format files
Diffstat (limited to 'src/main')
-rw-r--r--src/main/groovy/org/gradle/frege/FregeTask.groovy101
1 files changed, 54 insertions, 47 deletions
diff --git a/src/main/groovy/org/gradle/frege/FregeTask.groovy b/src/main/groovy/org/gradle/frege/FregeTask.groovy
index 5c26c60..6dffb95 100644
--- a/src/main/groovy/org/gradle/frege/FregeTask.groovy
+++ b/src/main/groovy/org/gradle/frege/FregeTask.groovy
@@ -10,70 +10,77 @@ import org.gradle.api.internal.file.FileResolver
class FregeTask extends DefaultTask {
- private static final FREGE_FILE_EXTENSION_PATTERN = ~/.*\.fr?$/
+ private static final FREGE_FILE_EXTENSION_PATTERN = ~/.*\.fr?$/
- @Input boolean hints
+ @Input
+ boolean hints
- @Input boolean verbose
+ @Input
+ boolean verbose
- @Input boolean inline = true
+ @Input
+ boolean inline = true
- @Input boolean make = true
+ @Input
+ boolean make = true
- @Input boolean skipCompile
+ @Input
+ boolean skipCompile
- @Input boolean includeStale
+ @Input
+ boolean includeStale
- // TODO: Find default
- @OutputDirectory File outputDir = new File("build/classes/main")
+ // TODO: Find default
+ @OutputDirectory
+ File outputDir = new File("build/classes/main")
- @TaskAction
- void executeCompile() {
- println "Compiling Frege to " + outputDir
- // access extension configuration values as ${project.frege.key1}
+ @TaskAction
+ void executeCompile() {
+ println "Compiling Frege to " + outputDir
+ // access extension configuration values as ${project.frege.key1}
- FileResolver fileResolver = getServices().get(FileResolver.class)
- JavaExecAction action = new DefaultJavaExecAction(fileResolver)
- action.setMain("frege.compiler.Main")
- action.setClasspath(project.files(project.configurations.compile))
+ FileResolver fileResolver = getServices().get(FileResolver.class)
+ JavaExecAction action = new DefaultJavaExecAction(fileResolver)
+ action.setMain("frege.compiler.Main")
+ 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"
+ 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
+ args << "-d"
+ args << outputDir
- eachFileRecurse(new File("src/main/frege")) { File file ->
- if (file.name =~ FREGE_FILE_EXTENSION_PATTERN) {
- args << file
- }
+ eachFileRecurse(new File("src/main/frege")) { File file ->
+ if (file.name =~ FREGE_FILE_EXTENSION_PATTERN) {
+ args << file
+ }
- }
+ }
- println("FregeTask args: $args")
- action.args(args)
+ println("FregeTask args: $args")
+ action.args(args)
- action.execute()
- }
+ action.execute()
+ }
- private static void eachFileRecurse(File dir, Closure fileProcessor) {
- dir.eachFile { File file ->
- if (file.directory) {
- eachFileRecurse(file, fileProcessor)
- } else {
- fileProcessor(file)
- }
+ private static void eachFileRecurse(File dir, Closure fileProcessor) {
+ dir.eachFile { File file ->
+ if (file.directory) {
+ eachFileRecurse(file, fileProcessor)
+ } else {
+ fileProcessor(file)
+ }
+ }
}
- }
} \ No newline at end of file