Skip to content

Commit 07805a5

Browse files
committed
Use shared configureIosSimulatorTasks
1 parent 89a5500 commit 07805a5

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

aws-crt-kotlin/build.gradle.kts

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import aws.sdk.kotlin.gradle.crt.configureCrtCMakeBuild
88
import aws.sdk.kotlin.gradle.crt.disableCrossCompileTargets
99
import aws.sdk.kotlin.gradle.dsl.configurePublishing
1010
import aws.sdk.kotlin.gradle.kmp.configureKmpTargets
11+
import aws.sdk.kotlin.gradle.kmp.configureIosSimulatorTasks
1112
import aws.sdk.kotlin.gradle.util.typedProp
1213
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
1314
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
@@ -97,47 +98,7 @@ kotlin {
9798
}
9899
}
99100

100-
// disable "standalone" mode in simulator tests since it causes TLS issues. this means we need to manage the simulator
101-
// ourselves (booting / shutting down). FIXME: https://youtrack.jetbrains.com/issue/KT-38317
102-
kotlin {
103-
val simulatorDeviceName = project.findProperty("iosSimulatorDevice") as? String ?: "iPhone 15"
104-
105-
val xcrun = "/usr/bin/xcrun"
106-
107-
tasks.register<Exec>("bootIosSimulatorDevice") {
108-
isIgnoreExitValue = true
109-
commandLine(xcrun, "simctl", "boot", simulatorDeviceName)
110-
111-
doLast {
112-
val result = executionResult.get()
113-
val code = result.exitValue
114-
if (code != 148 && code != 149) { // ignore "simulator already running" errors
115-
result.assertNormalExitValue()
116-
}
117-
}
118-
}
119-
120-
tasks.register<Exec>("shutdownIosSimulatorDevice") {
121-
mustRunAfter(tasks.withType<KotlinNativeSimulatorTest>())
122-
commandLine(xcrun, "simctl", "shutdown", simulatorDeviceName)
123-
124-
doLast {
125-
executionResult.get().assertNormalExitValue()
126-
}
127-
}
128-
129-
tasks.withType<KotlinNativeSimulatorTest>().configureEach {
130-
if (!HostManager.hostIsMac) {
131-
return@configureEach
132-
}
133-
134-
dependsOn("bootIosSimulatorDevice")
135-
finalizedBy("shutdownIosSimulatorDevice")
136-
137-
standalone = false
138-
device = simulatorDeviceName
139-
}
140-
}
101+
configureIosSimulatorTasks()
141102

142103
// Publishing
143104
configurePublishing("aws-crt-kotlin")

0 commit comments

Comments
 (0)