From 232d2ff14c0f640779035f58d1e5e993dbf4ff80 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Thu, 9 Mar 2017 12:54:26 +0300 Subject: [PATCH] tests: Compile only *.kt files --- .../groovy/org/jetbrains/kotlin/KonanTest.groovy | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index adcd636a3a1..cdca2155f9b 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -7,6 +7,7 @@ import org.gradle.api.tasks.ParallelizableTask import org.gradle.api.tasks.TaskAction import org.gradle.process.ExecResult +// TODO: add support for smap tests abstract class KonanTest extends JavaExec { protected String source def backendNative = project.project(":backend.native") @@ -101,6 +102,14 @@ abstract class KonanTest extends JavaExec { return str.replaceAll(~/(.*?)/) { all, text -> text } } + protected List registerKtFile(List sourceFiles, String newFilePath, String newFileContent) { + createFile(newFilePath, newFileContent) + if (newFilePath.endsWith(".kt")) { + sourceFiles.add(newFilePath) + } + return sourceFiles + } + // TODO refactor List buildCompileList() { def result = [] @@ -112,8 +121,7 @@ abstract class KonanTest extends JavaExec { if (!matcher.find()) { // There is only one file in the input def filePath = "$outputDirectory/${srcFile.name}" - createFile(filePath, srcText) - result.add(filePath) + registerKtFile(result, filePath, srcText) } else { // There are several files def processedChars = 0 @@ -124,8 +132,7 @@ abstract class KonanTest extends JavaExec { def end = nextFileExists ? matcher.start() : srcText.length() def fileText = srcText.substring(start, end) processedChars = end - createFile(filePath, fileText) - result.add(filePath) + registerKtFile(result, filePath, fileText) if (!nextFileExists) break } }