|
|
@ -33,21 +33,22 @@ fun Project.registerSimulatorTasks( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
val taskSimulatorDeleteUnavailable = tasks.composeIosTask<AbstractComposeIosTask>("iosSimulatorDeleteUnavailable$id") { |
|
|
|
val taskSimulatorDeleteUnavailable = tasks.composeIosTask<AbstractComposeIosTask>("iosSimulatorDeleteUnavailable$id") { |
|
|
|
val condition = { device: DeviceData -> device.name == deviceName && device.state.contains("unavailable") } |
|
|
|
|
|
|
|
onlyIf { |
|
|
|
|
|
|
|
getSimctlListData().devices.map { it.value }.flatten().any(condition) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
doLast { |
|
|
|
doLast { |
|
|
|
val device = getSimctlListData().devices.map { it.value }.flatten().first(condition) |
|
|
|
val device = getSimctlListData().devices.map { it.value }.flatten() |
|
|
|
|
|
|
|
.firstOrNull { device: DeviceData -> |
|
|
|
runExternalTool( |
|
|
|
val xcode13Condition = device.state.contains("unavailable") |
|
|
|
MacUtils.xcrun, |
|
|
|
val xcode14Condition = device.isAvailable == false |
|
|
|
listOf("simctl", "delete", device.udid) |
|
|
|
device.name == deviceName && (xcode13Condition || xcode14Condition) |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
if (device != null) { |
|
|
|
|
|
|
|
runExternalTool( |
|
|
|
|
|
|
|
MacUtils.xcrun, |
|
|
|
|
|
|
|
listOf("simctl", "delete", device.udid) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val taskCreateSimulator = tasks.composeIosTask<AbstractComposeIosTask>("iosSimulatorCreate$id") { |
|
|
|
val taskCreateSimulator = tasks.composeIosTask<AbstractComposeIosTask>("iosSimulatorCreate$id") { |
|
|
|
dependsOn(taskSimulatorDeleteUnavailable) |
|
|
|
dependsOn(taskSimulatorDeleteUnavailable) |
|
|
|
onlyIf { getSimctlListData().devices.map { it.value }.flatten().none { it.name == deviceName } } |
|
|
|
onlyIf { getSimctlListData().devices.map { it.value }.flatten().none { it.name == deviceName } } |
|
|
|