From ccb4caf29efd5d60a1ff606a9d8f933488614183 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 6 Sep 2017 11:34:54 +0300 Subject: [PATCH] [performance][bench] don't access to build folder before compilation task finished. --- performance/build.gradle | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/performance/build.gradle b/performance/build.gradle index 4bdc298083b..6ce79c8268b 100644 --- a/performance/build.gradle +++ b/performance/build.gradle @@ -61,22 +61,28 @@ dependencies { } task jvmRun(type: JavaExec) { - def output = new FileOutputStream("${buildDir.absolutePath}/jvmReport.txt") + def output = new ByteArrayOutputStream() classpath sourceSets.main.runtimeClasspath main = "MainKt" args "$ringWarmup", "$iterations" standardOutput = output doLast { - output.close() + dumpReport('jvmReport', output) + } +} + +private void dumpReport(String name, ByteArrayOutputStream output) { + new File("${buildDir.absolutePath}/${name}.txt").withOutputStream { + it.write(output.toByteArray()) } } task konanRun(type: Exec) { - def output = new FileOutputStream("${buildDir.absolutePath}/konanReport.txt") + def output = new ByteArrayOutputStream() commandLine project.file("build/konan/bin/Ring.kexe").absolutePath, "$ringWarmup", "$iterations" standardOutput = output doLast { - output.close() + dumpReport('konanReport', output) } }