Make kotlin-test-js integration test tasks incremental

Define their inputs and outputs, so they are run only
when js files in build/node-modules change. These don't include external
libraries node-modules
This commit is contained in:
Ilya Gorbunov
2019-07-12 18:01:01 +03:00
parent 385366384c
commit 5e8192bf74
+10 -3
View File
@@ -37,15 +37,22 @@ def createFrameworkTest(def name) {
return tasks.create("test$name", NpmTask) { return tasks.create("test$name", NpmTask) {
dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall) dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall)
def lowerName = name.toLowerCase() def lowerName = name.toLowerCase()
def tcOutput = "$buildDir/tc-${lowerName}.log"
def stdOutput = "$buildDir/test-${lowerName}.log"
def errOutput = "$buildDir/test-${lowerName}.err.log"
inputs.files(sourceSets.test.output)
inputs.dir("${buildDir}/node_modules")
outputs.files(tcOutput, stdOutput, errOutput)
args = ['run', "test-$lowerName"] args = ['run', "test-$lowerName"]
group = 'verification' group = 'verification'
execOverrides { execOverrides {
it.ignoreExitValue = true it.ignoreExitValue = true
it.standardOutput = new FileOutputStream("$buildDir/test-${lowerName}.log") it.standardOutput = new FileOutputStream(stdOutput)
it.errorOutput = new FileOutputStream("$buildDir/test-${lowerName}.err.log") it.errorOutput = new FileOutputStream(errOutput)
} }
doLast { doLast {
println file("$buildDir/tc-${lowerName}.log").text println file(tcOutput).text
if (result.exitValue != 0 && !rootProject.ignoreTestFailures) { if (result.exitValue != 0 && !rootProject.ignoreTestFailures) {
throw new GradleException("$name integration test failed") throw new GradleException("$name integration test failed")
} }