diff options
author | Rene Groeschke <rene@gradle.com> | 2015-11-23 23:37:22 +0000 |
---|---|---|
committer | Rene Groeschke <rene@gradle.com> | 2015-11-23 23:37:22 +0000 |
commit | dd954e14c06f7568a6009b303a50c50a4e2216cf (patch) | |
tree | 7e23c35076e678f4634767934782b5e1e9625e62 | |
parent | e2259af79dab2a3e132a7d049d180c47ee8a43b8 (diff) | |
download | frege-gradle-plugin-dd954e14c06f7568a6009b303a50c50a4e2216cf.tar.gz frege-gradle-plugin-dd954e14c06f7568a6009b303a50c50a4e2216cf.tar.bz2 frege-gradle-plugin-dd954e14c06f7568a6009b303a50c50a4e2216cf.zip |
fix FregeCompile incremental build behaviour
-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; } |