@@ -126,11 +126,12 @@ subprojects {
126126 * https://youtrack.jetbrains.com/issue/KT-38317
127127 */
128128public fun Project.smithyConfigureIosSimulatorTasks () {
129- val simulatorDeviceName = project.findProperty( " iosSimulatorDevice " ) as ? String ? : " iPhone 15 "
129+ if ( ! HostManager .hostIsMac) return
130130
131+ val simulatorDeviceName = project.findProperty(" iosSimulatorDevice" ) as ? String ? : " iPhone 15"
131132 val xcrun = " /usr/bin/xcrun"
132133
133- tasks.register (" bootIosSimulatorDevice" , Exec ::class .java) {
134+ val bootTask = rootProject. tasks.maybeCreate (" bootIosSimulatorDevice" , Exec ::class .java). apply {
134135 isIgnoreExitValue = true
135136 commandLine(xcrun, " simctl" , " boot" , simulatorDeviceName)
136137
@@ -143,9 +144,8 @@ public fun Project.smithyConfigureIosSimulatorTasks() {
143144 }
144145 }
145146
146- tasks.register (" shutdownIosSimulatorDevice" , Exec ::class .java) {
147+ val shutdownTask = rootProject. tasks.maybeCreate (" shutdownIosSimulatorDevice" , Exec ::class .java). apply {
147148 isIgnoreExitValue = true
148- mustRunAfter(tasks.withType<KotlinNativeSimulatorTest >())
149149 commandLine(xcrun, " simctl" , " shutdown" , simulatorDeviceName)
150150
151151 doLast {
@@ -157,15 +157,14 @@ public fun Project.smithyConfigureIosSimulatorTasks() {
157157 }
158158 }
159159
160- tasks.withType<KotlinNativeSimulatorTest >().configureEach {
161- if (! HostManager .hostIsMac) {
162- return @configureEach
160+ allprojects {
161+ val simulatorTasks = tasks.withType<KotlinNativeSimulatorTest >()
162+ simulatorTasks.configureEach {
163+ dependsOn(bootTask)
164+ standalone.set(false )
165+ device.set(simulatorDeviceName)
163166 }
164-
165- dependsOn(" bootIosSimulatorDevice" )
166- finalizedBy(" shutdownIosSimulatorDevice" )
167-
168- standalone.set(false )
169- device.set(simulatorDeviceName)
167+ shutdownTask.mustRunAfter(simulatorTasks)
170168 }
171169}
170+
0 commit comments