aboutsummaryrefslogtreecommitdiff
path: root/src/main/groovy/frege/gradle/tasks
diff options
context:
space:
mode:
authorRene Groeschke <rene@gradle.com>2015-11-22 00:50:45 +0000
committerRene Groeschke <rene@gradle.com>2015-11-22 00:50:45 +0000
commitfdc7b27d69b22e0ffa151d56c8f3812dcd229555 (patch)
treef67fb55cdf48e05596f6d71e2b7f11e6853f5f28 /src/main/groovy/frege/gradle/tasks
parenta676a61ddf3478356b43b4b7f947e6f769cde50e (diff)
downloadfrege-gradle-plugin-fdc7b27d69b22e0ffa151d56c8f3812dcd229555.tar.gz
frege-gradle-plugin-fdc7b27d69b22e0ffa151d56c8f3812dcd229555.tar.bz2
frege-gradle-plugin-fdc7b27d69b22e0ffa151d56c8f3812dcd229555.zip
some more work on coverage and some cleanup
- get packages for integ tests right - introduce common AbstractFregeIntegrationSpec - first stab of unit test coverage for FregeCompile - minor cleanup on FregeCompile - configure fregePath as part as part of base plugin convention
Diffstat (limited to 'src/main/groovy/frege/gradle/tasks')
-rw-r--r--src/main/groovy/frege/gradle/tasks/FregeCompile.groovy20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
index 3da2b34..8c63df6 100644
--- a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
+++ b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy
@@ -1,8 +1,10 @@
package frege.gradle.tasks
+
import groovy.transform.TypeChecked
import org.gradle.api.Action
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.compile.AbstractCompile
@@ -54,8 +56,8 @@ class FregeCompile extends AbstractCompile {
@Input
String module = ""
- @Input
- List<File> fregePaths = []
+ @Optional @InputFiles
+ FileCollection fregePath
@Input
String mainClass = "frege.compiler.Main"
@@ -84,14 +86,20 @@ class FregeCompile extends AbstractCompile {
logger.info("Calling Frege compiler with compilerArgs: '$compilerArgs'")
//TODO integrate with gradle compiler daemon infrastructure and skip internal execution
+
+ def errOutputStream = new ByteArrayOutputStream();
+ def outOutputStream = new ByteArrayOutputStream();
project.javaexec(new Action<JavaExecSpec>() {
@Override
void execute(JavaExecSpec javaExecSpec) {
javaExecSpec.args = compilerArgs
javaExecSpec.classpath = FregeCompile.this.classpath
javaExecSpec.main = mainClass
+ javaExecSpec.errorOutput = System.err;
+ javaExecSpec.standardOutput = System.out;
}
});
+
}
public FregeCompile source(Object... sources) {
@@ -129,10 +137,10 @@ class FregeCompile extends AbstractCompile {
if (verbose)
args << "-v"
- def fp = fregePaths
- if (!fp.isEmpty()) {
+
+ if (fregePath != null && !fregePath.isEmpty()) {
args << "-fp"
- args << fp.collect { f -> f.absolutePath }.join(File.pathSeparator)
+ args << fregePath.files.collect { f -> f.absolutePath }.join(File.pathSeparator)
}
if (sourcePaths != null && !sourcePaths.isEmpty()) {
@@ -151,7 +159,7 @@ class FregeCompile extends AbstractCompile {
}
args << "-d"
- args << getDestinationDir()
+ args << getDestinationDir().absolutePath
if (!module.isEmpty()) {
logger.info "compiling module '$module'"