tests: Compile only *.kt files
This commit is contained in:
@@ -7,6 +7,7 @@ import org.gradle.api.tasks.ParallelizableTask
|
|||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.gradle.process.ExecResult
|
import org.gradle.process.ExecResult
|
||||||
|
|
||||||
|
// TODO: add support for smap tests
|
||||||
abstract class KonanTest extends JavaExec {
|
abstract class KonanTest extends JavaExec {
|
||||||
protected String source
|
protected String source
|
||||||
def backendNative = project.project(":backend.native")
|
def backendNative = project.project(":backend.native")
|
||||||
@@ -101,6 +102,14 @@ abstract class KonanTest extends JavaExec {
|
|||||||
return str.replaceAll(~/<!.*?!>(.*?)<!>/) { all, text -> text }
|
return str.replaceAll(~/<!.*?!>(.*?)<!>/) { all, text -> text }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected List<String> registerKtFile(List<String> sourceFiles, String newFilePath, String newFileContent) {
|
||||||
|
createFile(newFilePath, newFileContent)
|
||||||
|
if (newFilePath.endsWith(".kt")) {
|
||||||
|
sourceFiles.add(newFilePath)
|
||||||
|
}
|
||||||
|
return sourceFiles
|
||||||
|
}
|
||||||
|
|
||||||
// TODO refactor
|
// TODO refactor
|
||||||
List<String> buildCompileList() {
|
List<String> buildCompileList() {
|
||||||
def result = []
|
def result = []
|
||||||
@@ -112,8 +121,7 @@ abstract class KonanTest extends JavaExec {
|
|||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
// There is only one file in the input
|
// There is only one file in the input
|
||||||
def filePath = "$outputDirectory/${srcFile.name}"
|
def filePath = "$outputDirectory/${srcFile.name}"
|
||||||
createFile(filePath, srcText)
|
registerKtFile(result, filePath, srcText)
|
||||||
result.add(filePath)
|
|
||||||
} else {
|
} else {
|
||||||
// There are several files
|
// There are several files
|
||||||
def processedChars = 0
|
def processedChars = 0
|
||||||
@@ -124,8 +132,7 @@ abstract class KonanTest extends JavaExec {
|
|||||||
def end = nextFileExists ? matcher.start() : srcText.length()
|
def end = nextFileExists ? matcher.start() : srcText.length()
|
||||||
def fileText = srcText.substring(start, end)
|
def fileText = srcText.substring(start, end)
|
||||||
processedChars = end
|
processedChars = end
|
||||||
createFile(filePath, fileText)
|
registerKtFile(result, filePath, fileText)
|
||||||
result.add(filePath)
|
|
||||||
if (!nextFileExists) break
|
if (!nextFileExists) break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user