diff options
-rw-r--r-- | src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy | 27 | ||||
-rw-r--r-- | src/main/groovy/frege/gradle/tasks/FregeCompile.groovy | 11 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy index 3845e23..1d01552 100644 --- a/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy +++ b/src/integTest/groovy/frege/gradle/tasks/FregeCompileIntegTest.groovy @@ -2,6 +2,8 @@ package frege.gradle.tasks import frege.gradle.integtest.fixtures.AbstractFregeIntegrationSpec import static org.gradle.testkit.runner.TaskOutcome.FAILED +import static org.gradle.testkit.runner.TaskOutcome.SUCCESS +import static org.gradle.testkit.runner.TaskOutcome.UP_TO_DATE class FregeCompileIntegTest extends AbstractFregeIntegrationSpec { @@ -47,6 +49,31 @@ class FregeCompileIntegTest extends AbstractFregeIntegrationSpec { result.output.contains("Failing.fr:6: can't resolve `Hello`") } + def "is incremental"() { + given: + simpleFrege() + + buildFile << """ + compile.doLast { + println System.identityHashCode(compile.allJvmArgs) + println compile.allJvmArgs + println compile.allJvmArgs.getClass() + } +""" + when: + def result = run("compile") + + then: + result.task(":compile").outcome == SUCCESS + + when: + result = run("compile") + + then: + result.task(":compile").outcome == UP_TO_DATE + } + + def failingFrege() { def failingFrege = testProjectDir.newFile("frege-src/Failing.fr") failingFrege << """ diff --git a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy index 290f750..1b32351 100644 --- a/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy +++ b/src/main/groovy/frege/gradle/tasks/FregeCompile.groovy @@ -62,7 +62,6 @@ class FregeCompile extends AbstractCompile { @Input String mainClass = "frege.compiler.Main" - @Optional @Input List<String> allJvmArgs = [] @@ -77,24 +76,18 @@ class FregeCompile extends AbstractCompile { @Override @TaskAction protected void compile() { - def jvmArgs = allJvmArgs - if (jvmArgs.isEmpty()) { - jvmArgs << "-Xss$stackSize".toString() - } + def jvmArgumentsToUse = allJvmArgs.empty ? ["-Xss$stackSize"] : new ArrayList<String>(allJvmArgs) def compilerArgs = allArgs ? allArgs.split().toList() : assembleArguments() 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.jvmArgs = jvmArgumentsToUse javaExecSpec.errorOutput = System.err; javaExecSpec.standardOutput = System.out; } |