@@ -140,16 +140,44 @@ val KotlinMultiplatformVersion?.isNewMPP: Boolean
|
|||||||
val KotlinMultiplatformVersion?.isHmpp: Boolean
|
val KotlinMultiplatformVersion?.isHmpp: Boolean
|
||||||
get() = this == KotlinMultiplatformVersion.M3
|
get() = this == KotlinMultiplatformVersion.M3
|
||||||
|
|
||||||
data class ExternalSystemTestTask(val testName: String, val externalSystemProjectId: String, val targetName: String?) {
|
interface ExternalSystemRunTask {
|
||||||
|
val taskName: String
|
||||||
|
val externalSystemProjectId: String
|
||||||
|
val targetName: String?
|
||||||
|
}
|
||||||
|
|
||||||
fun toStringRepresentation() = "$testName|$externalSystemProjectId|$targetName"
|
data class ExternalSystemTestRunTask(
|
||||||
|
override val taskName: String,
|
||||||
|
override val externalSystemProjectId: String,
|
||||||
|
override val targetName: String?
|
||||||
|
) : ExternalSystemRunTask {
|
||||||
|
|
||||||
|
fun toStringRepresentation() = "$taskName|$externalSystemProjectId|$targetName"
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun fromStringRepresentation(line: String) =
|
fun fromStringRepresentation(line: String) =
|
||||||
line.split("|").let { if (it.size == 3) ExternalSystemTestTask(it[0], it[1], it[2]) else null }
|
line.split("|").let { if (it.size == 3) ExternalSystemTestRunTask(it[0], it[1], it[2]) else null }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = "$testName@$externalSystemProjectId [$targetName]"
|
override fun toString() = "$taskName@$externalSystemProjectId [$targetName]"
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ExternalSystemNativeMainRunTask(
|
||||||
|
override val taskName: String,
|
||||||
|
override val externalSystemProjectId: String,
|
||||||
|
override val targetName: String?,
|
||||||
|
val entryPoint: String,
|
||||||
|
val debuggable: Boolean,
|
||||||
|
) : ExternalSystemRunTask {
|
||||||
|
|
||||||
|
fun toStringRepresentation() = "$taskName|$externalSystemProjectId|$targetName|$entryPoint|$debuggable"
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun fromStringRepresentation(line: String): ExternalSystemNativeMainRunTask? =
|
||||||
|
line.split("|").let {
|
||||||
|
if (it.size == 5) ExternalSystemNativeMainRunTask(it[0], it[1], it[2], it[3], it[4].toBoolean()) else null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinFacetSettings {
|
class KotlinFacetSettings {
|
||||||
@@ -231,7 +259,7 @@ class KotlinFacetSettings {
|
|||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
|
|
||||||
var externalSystemTestTasks: List<ExternalSystemTestTask> = emptyList()
|
var externalSystemRunTasks: List<ExternalSystemRunTask> = emptyList()
|
||||||
|
|
||||||
@Suppress("DEPRECATION_ERROR")
|
@Suppress("DEPRECATION_ERROR")
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
@@ -126,8 +126,15 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings {
|
|||||||
this.targetPlatform = targetPlatform
|
this.targetPlatform = targetPlatform
|
||||||
readElementsList(element, "implements", "implement")?.let { implementedModuleNames = it }
|
readElementsList(element, "implements", "implement")?.let { implementedModuleNames = it }
|
||||||
readElementsList(element, "dependsOnModuleNames", "dependsOn")?.let { dependsOnModuleNames = it }
|
readElementsList(element, "dependsOnModuleNames", "dependsOn")?.let { dependsOnModuleNames = it }
|
||||||
readElementsList(element, "externalSystemTestTasks", "externalSystemTestTask")?.let {
|
element.getChild("externalSystemTestTasks")?.let {
|
||||||
externalSystemTestTasks = it.mapNotNull { ExternalSystemTestTask.fromStringRepresentation(it) }
|
val testRunTasks = it.getChildren("externalSystemTestTask")
|
||||||
|
.mapNotNull { (it.content.firstOrNull() as? Text)?.textTrim }
|
||||||
|
.mapNotNull { ExternalSystemTestRunTask.fromStringRepresentation(it) }
|
||||||
|
val nativeMainRunTasks = it.getChildren("externalSystemNativeMainRunTask")
|
||||||
|
.mapNotNull { (it.content.firstOrNull() as? Text)?.textTrim }
|
||||||
|
.mapNotNull { ExternalSystemNativeMainRunTask.fromStringRepresentation(it) }
|
||||||
|
|
||||||
|
externalSystemRunTasks = testRunTasks + nativeMainRunTasks
|
||||||
}
|
}
|
||||||
|
|
||||||
element.getChild("sourceSets")?.let {
|
element.getChild("sourceSets")?.let {
|
||||||
@@ -318,12 +325,24 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
|
|||||||
if (isHmppEnabled) {
|
if (isHmppEnabled) {
|
||||||
element.setAttribute("isHmppProject", mppVersion.isHmpp.toString())
|
element.setAttribute("isHmppProject", mppVersion.isHmpp.toString())
|
||||||
}
|
}
|
||||||
if (externalSystemTestTasks.isNotEmpty()) {
|
if (externalSystemRunTasks.isNotEmpty()) {
|
||||||
saveElementsList(
|
element.addContent(
|
||||||
element,
|
Element("externalSystemTestTasks").apply {
|
||||||
externalSystemTestTasks.map { it.toStringRepresentation() },
|
externalSystemRunTasks.forEach { task ->
|
||||||
"externalSystemTestTasks",
|
when(task) {
|
||||||
"externalSystemTestTask"
|
is ExternalSystemTestRunTask -> {
|
||||||
|
addContent(
|
||||||
|
Element("externalSystemTestTask").apply { addContent(task.toStringRepresentation()) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is ExternalSystemNativeMainRunTask -> {
|
||||||
|
addContent(
|
||||||
|
Element("externalSystemNativeMainRunTask").apply { addContent(task.toStringRepresentation()) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (pureKotlinSourceFolders.isNotEmpty()) {
|
if (pureKotlinSourceFolders.isNotEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user