diff options
-rw-r--r-- | build.gradle | 5 | ||||
-rw-r--r-- | src/main/groovy/org/gradle/frege/FregeTask.groovy | 101 |
2 files changed, 56 insertions, 50 deletions
diff --git a/build.gradle b/build.gradle index d14e20b..07cb4ec 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - apply plugin: "groovy" apply plugin: "maven" apply plugin: "signing" @@ -18,7 +17,7 @@ ext { apply from: "gradle/sonatype.gradle" repositories { - mavenCentral() + mavenCentral() } version = pluginVersion @@ -31,6 +30,6 @@ dependencies { } Boolean doSigning() { - signingEnabled.trim() == "true" + signingEnabled.trim() == "true" } 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 |