1
1
Fork 0

Build change: don't fail when error output has only one line

This commit is contained in:
Svetlana Isakova 2020-07-29 12:11:53 +02:00
parent a6b54925ba
commit 2bcb9ad885
1 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
def printOutput(def output) { def printOutput(def output) {
return tasks.create("printOutput") { return tasks.create("printOutput") {
for (line in output.toString().readLines()) { for (line in output.toString().readLines()) {
@ -14,6 +15,7 @@ def printOutput(def output) {
} }
} }
} }
allprojects { allprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'kotlin' apply plugin: 'kotlin'
@ -92,9 +94,11 @@ sourceSets {
} }
} }
} }
static def isTaskDir(File dir) { static def isTaskDir(File dir) {
return new File(dir, "src").exists() return new File(dir, "src").exists()
} }
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "" mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : ""
test { test {
outputs.upToDateWhen { false } outputs.upToDateWhen { false }
@ -103,11 +107,13 @@ test {
def message = result.exception?.message ?: "Wrong answer" def message = result.exception?.message ?: "Wrong answer"
def lines = message.readLines() def lines = message.readLines()
println "#educational_plugin FAILED + " + lines[0] println "#educational_plugin FAILED + " + lines[0]
lines[1..-1].forEach { line -> if (lines.size() > 1) {
println "#educational_plugin" + line lines[1..-1].forEach { line ->
println "#educational_plugin" + line
}
} }
// we need this to separate output of different tests // we need this to separate output of different tests
println println ""
} }
} }
} }