diff options
author | Rene Groeschke <rene@gradle.com> | 2015-12-29 15:56:04 +0100 |
---|---|---|
committer | Rene Groeschke <rene@gradle.com> | 2015-12-29 15:56:04 +0100 |
commit | edb3e94f2e2c14b6f6cd899f0fe5d8227c7f2dbd (patch) | |
tree | bbf31f8f5df697ab17d7e6779e84d1195bff67ba /src/main/groovy/frege/gradle/tasks | |
parent | 7fb3f43096fa6b142eb059e1eeaca79abcaa3009 (diff) | |
download | frege-gradle-plugin-edb3e94f2e2c14b6f6cd899f0fe5d8227c7f2dbd.tar.gz frege-gradle-plugin-edb3e94f2e2c14b6f6cd899f0fe5d8227c7f2dbd.tar.bz2 frege-gradle-plugin-edb3e94f2e2c14b6f6cd899f0fe5d8227c7f2dbd.zip |
workaround for failing fregedoc when ignoring java sources
Diffstat (limited to 'src/main/groovy/frege/gradle/tasks')
-rw-r--r-- | src/main/groovy/frege/gradle/tasks/FregeDoc.groovy | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy index af4b924..30f62c6 100644 --- a/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy +++ b/src/main/groovy/frege/gradle/tasks/FregeDoc.groovy @@ -1,7 +1,9 @@ package frege.gradle.tasks +import org.apache.commons.io.output.TeeOutputStream import org.gradle.api.Action import org.gradle.api.DefaultTask +import org.gradle.api.GradleException import org.gradle.api.file.FileCollection import org.gradle.api.tasks.Input import org.gradle.api.tasks.Optional @@ -50,6 +52,8 @@ class FregeDoc extends DefaultTask { @TaskAction void fregedoc() { + ByteArrayOutputStream berr = new ByteArrayOutputStream() + def teeOutputStream = new TeeOutputStream(System.err, berr) def result = project.javaexec(new Action<JavaExecSpec>() { @Override void execute(JavaExecSpec javaExecSpec) { @@ -65,11 +69,18 @@ class FregeDoc extends DefaultTask { javaExecSpec.workingDir = project.projectDir javaExecSpec.standardInput = System.in javaExecSpec.standardOutput = System.out - javaExecSpec.errorOutput = System.err + javaExecSpec.errorOutput = teeOutputStream javaExecSpec.classpath = this.classpath + + javaExecSpec.ignoreExitValue = true } }) - } + //Workaround for failing with java sources. should result in exit value 0 anyway. + def berrString = berr.toString() + if (result.exitValue !=0 && !berrString.contains("there were errors for")) { + throw new GradleException("Non zero exit value running FregeDoc."); + } + } } |