diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 34275f57a6e..a1307b6073a 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -38,17 +38,25 @@ abstract class KonanTest extends DefaultTask { abstract void compileTest(List filesToCompile, String exe) protected void runCompiler(List filesToCompile, String output, List moreArgs) { - project.javaexec { - main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' - classpath = project.configurations.cli_bc - jvmArgs "-ea", - "-Dkonan.home=${dist.canonicalPath}", - "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" - args("-output", output, - *filesToCompile, - *moreArgs, - *project.globalArgs) - + def log = new ByteArrayOutputStream() + try { + project.javaexec { + main = 'org.jetbrains.kotlin.cli.bc.K2NativeKt' + classpath = project.configurations.cli_bc + jvmArgs "-ea", + "-Dkonan.home=${dist.canonicalPath}", + "-Djava.library.path=${dist.canonicalPath}/konan/nativelib" + args("-output", output, + *filesToCompile, + *moreArgs, + *project.globalArgs) + standardOutput = log + errorOutput = log + } + } finally { + def logString = log.toString() + project.file("${output}.compilation.log").write(logString) + println(logString) } } @@ -128,12 +136,6 @@ class RunExternalTestGroup extends RunKonanTest { String filter = project.findProperty("filter") String goldValue = "OK" - String buildExePath() { - def exeName = "${name}.kt.exe" - def tempDir = temporaryDir.absolutePath - return "$tempDir/$exeName" - } - // TODO refactor List buildCompileList() { def result = []