Support prefixed modularized test-data installation
This commit is contained in:
+18
-11
@@ -17,14 +17,19 @@ import javax.xml.parsers.DocumentBuilderFactory
|
|||||||
|
|
||||||
data class ModuleData(
|
data class ModuleData(
|
||||||
val name: String,
|
val name: String,
|
||||||
val outputDir: String,
|
val rawOutputDir: String,
|
||||||
val qualifier: String,
|
val qualifier: String,
|
||||||
val classpath: List<File>,
|
val rawClasspath: List<String>,
|
||||||
val sources: List<File>,
|
val rawSources: List<String>,
|
||||||
val javaSourceRoots: List<File>,
|
val rawJavaSourceRoots: List<String>,
|
||||||
val isCommon: Boolean
|
val isCommon: Boolean
|
||||||
) {
|
) {
|
||||||
val qualifiedName get() = if (name in qualifier) qualifier else "$name.$qualifier"
|
val qualifiedName get() = if (name in qualifier) qualifier else "$name.$qualifier"
|
||||||
|
|
||||||
|
val outputDir = File(ROOT_PATH_PREFIX, rawOutputDir.removePrefix("/"))
|
||||||
|
val classpath = rawClasspath.map { File(ROOT_PATH_PREFIX, it.removePrefix("/")) }
|
||||||
|
val sources = rawSources.map { File(ROOT_PATH_PREFIX, it.removePrefix("/")) }
|
||||||
|
val javaSourceRoots = rawJavaSourceRoots.map { File(ROOT_PATH_PREFIX, it.removePrefix("/")) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun NodeList.toList(): List<Node> {
|
private fun NodeList.toList(): List<Node> {
|
||||||
@@ -38,6 +43,8 @@ private fun NodeList.toList(): List<Node> {
|
|||||||
|
|
||||||
private val Node.childNodesList get() = childNodes.toList()
|
private val Node.childNodesList get() = childNodes.toList()
|
||||||
|
|
||||||
|
private val ROOT_PATH_PREFIX = System.getProperty("fir.bench.prefix", "/")
|
||||||
|
|
||||||
abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
||||||
private val folderDateFormat = SimpleDateFormat("yyyy-MM-dd")
|
private val folderDateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||||
private lateinit var startDate: Date
|
private lateinit var startDate: Date
|
||||||
@@ -74,9 +81,9 @@ abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
|||||||
val moduleName = moduleElement.attributes.getNamedItem("name").nodeValue
|
val moduleName = moduleElement.attributes.getNamedItem("name").nodeValue
|
||||||
val outputDir = moduleElement.attributes.getNamedItem("outputDir").nodeValue
|
val outputDir = moduleElement.attributes.getNamedItem("outputDir").nodeValue
|
||||||
val moduleNameQualifier = outputDir.substringAfterLast("/")
|
val moduleNameQualifier = outputDir.substringAfterLast("/")
|
||||||
val javaSourceRoots = mutableListOf<File>()
|
val javaSourceRoots = mutableListOf<String>()
|
||||||
val classpath = mutableListOf<File>()
|
val classpath = mutableListOf<String>()
|
||||||
val sources = mutableListOf<File>()
|
val sources = mutableListOf<String>()
|
||||||
var isCommon = false
|
var isCommon = false
|
||||||
|
|
||||||
for (index in 0 until moduleElement.childNodes.length) {
|
for (index in 0 until moduleElement.childNodes.length) {
|
||||||
@@ -85,14 +92,14 @@ abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
|||||||
if (item.nodeName == "classpath") {
|
if (item.nodeName == "classpath") {
|
||||||
val path = item.attributes.getNamedItem("path").nodeValue
|
val path = item.attributes.getNamedItem("path").nodeValue
|
||||||
if (path != outputDir) {
|
if (path != outputDir) {
|
||||||
classpath += File(path)
|
classpath += path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.nodeName == "javaSourceRoots") {
|
if (item.nodeName == "javaSourceRoots") {
|
||||||
javaSourceRoots += File(item.attributes.getNamedItem("path").nodeValue)
|
javaSourceRoots += item.attributes.getNamedItem("path").nodeValue
|
||||||
}
|
}
|
||||||
if (item.nodeName == "sources") {
|
if (item.nodeName == "sources") {
|
||||||
sources += File(item.attributes.getNamedItem("path").nodeValue)
|
sources += item.attributes.getNamedItem("path").nodeValue
|
||||||
}
|
}
|
||||||
if (item.nodeName == "commonSources") {
|
if (item.nodeName == "commonSources") {
|
||||||
isCommon = true
|
isCommon = true
|
||||||
@@ -118,7 +125,7 @@ abstract class AbstractModularizedTest : KtUsefulTestCase() {
|
|||||||
val filterRegex = (System.getProperty("fir.bench.filter") ?: ".*").toRegex()
|
val filterRegex = (System.getProperty("fir.bench.filter") ?: ".*").toRegex()
|
||||||
val modules =
|
val modules =
|
||||||
root.listFiles().sortedBy { it.lastModified() }.map { loadModule(it) }
|
root.listFiles().sortedBy { it.lastModified() }.map { loadModule(it) }
|
||||||
.filter { it.outputDir.matches(filterRegex) }
|
.filter { it.rawOutputDir.matches(filterRegex) }
|
||||||
.filter { !it.isCommon }
|
.filter { !it.isCommon }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user