Skip to content

Commit 0329966

Browse files
committed
Fix duplicate source roots
1 parent 9ec38e3 commit 0329966

File tree

6 files changed

+149
-22
lines changed

6 files changed

+149
-22
lines changed

Diff for: ktor-test-dispatcher/build.gradle.kts

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
val ideaActive: Boolean by project.extra
22
val isMacosHost: Boolean by project.extra
3+
34
kotlin {
45
sourceSets {
56
if (ideaActive) {
@@ -13,28 +14,6 @@ kotlin {
1314
}
1415

1516
get("posixMain").dependsOn(posixIde)
16-
} else {
17-
configure(listOf(watchosArm32().compilations.get("main").defaultSourceSet)) {
18-
kotlin.srcDir("iosArm32/src")
19-
}
20-
21-
configure(
22-
listOf(
23-
watchosArm64().compilations.get("main").defaultSourceSet,
24-
tvosArm64().compilations.get("main").defaultSourceSet
25-
)
26-
) {
27-
kotlin.srcDir("iosArm64/src")
28-
}
29-
30-
configure(
31-
listOf(
32-
watchosX86().compilations.get("main").defaultSourceSet,
33-
tvosX64().compilations.get("main").defaultSourceSet
34-
)
35-
) {
36-
kotlin.srcDir("iosX64")
37-
}
3817
}
3918
}
4019
}

Diff for: ktor-test-dispatcher/tvosArm64/src/TestTvosArm64.kt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
2+
3+
package io.ktor.test.dispatcher
4+
5+
import kotlinx.coroutines.*
6+
import kotlin.coroutines.*
7+
import platform.Foundation.*
8+
9+
/**
10+
* Amount of time any task is processed and can't be rescheduled.
11+
*/
12+
private const val TIME_QUANTUM = 0.01
13+
14+
/**
15+
* Test runner for native suspend tests.
16+
*/
17+
actual fun testSuspend(
18+
context: CoroutineContext,
19+
block: suspend CoroutineScope.() -> Unit
20+
): Unit = runBlocking {
21+
val loop = coroutineContext[ContinuationInterceptor] as EventLoop
22+
23+
val task = launch { block() }
24+
while (!task.isCompleted) {
25+
val date = NSDate().addTimeInterval(TIME_QUANTUM) as NSDate
26+
NSRunLoop.mainRunLoop.runUntilDate(date)
27+
28+
loop.processNextEvent()
29+
}
30+
}

Diff for: ktor-test-dispatcher/tvosX64/src/TestTvosX64.kt

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
2+
3+
import kotlinx.coroutines.*
4+
import kotlin.coroutines.*
5+
import platform.Foundation.*
6+
7+
/**
8+
* Amount of time any task is processed and can't be rescheduled.
9+
*/
10+
private const val TIME_QUANTUM = 0.01
11+
12+
/**
13+
* Test runner for native suspend tests.
14+
*/
15+
actual fun testSuspend(
16+
context: CoroutineContext,
17+
block: suspend CoroutineScope.() -> Unit
18+
): Unit = runBlocking {
19+
val loop = coroutineContext[ContinuationInterceptor] as EventLoop
20+
21+
val task = launch { block() }
22+
while (!task.isCompleted) {
23+
val date = NSDate().addTimeInterval(TIME_QUANTUM) as NSDate
24+
NSRunLoop.mainRunLoop.runUntilDate(date)
25+
26+
loop.processNextEvent()
27+
}
28+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
2+
3+
package io.ktor.test.dispatcher
4+
5+
import kotlinx.coroutines.*
6+
import kotlin.coroutines.*
7+
import platform.Foundation.*
8+
9+
/**
10+
* Amount of time any task is processed and can't be rescheduled.
11+
*/
12+
private const val TIME_QUANTUM = 0.01
13+
14+
/**
15+
* Test runner for native suspend tests.
16+
*/
17+
actual fun testSuspend(
18+
context: CoroutineContext,
19+
block: suspend CoroutineScope.() -> Unit
20+
): Unit = runBlocking {
21+
val loop = coroutineContext[ContinuationInterceptor] as EventLoop
22+
23+
val task = launch { block() }
24+
while (!task.isCompleted) {
25+
val date = NSDate().addTimeInterval(TIME_QUANTUM) as NSDate
26+
NSRunLoop.mainRunLoop.runUntilDate(date)
27+
28+
loop.processNextEvent()
29+
}
30+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
2+
3+
package io.ktor.test.dispatcher
4+
5+
import kotlinx.coroutines.*
6+
import kotlin.coroutines.*
7+
import platform.Foundation.*
8+
9+
/**
10+
* Amount of time any task is processed and can't be rescheduled.
11+
*/
12+
private const val TIME_QUANTUM = 0.01
13+
14+
/**
15+
* Test runner for native suspend tests.
16+
*/
17+
actual fun testSuspend(
18+
context: CoroutineContext,
19+
block: suspend CoroutineScope.() -> Unit
20+
): Unit = runBlocking {
21+
val loop = coroutineContext[ContinuationInterceptor] as EventLoop
22+
23+
val task = launch { block() }
24+
while (!task.isCompleted) {
25+
val date = NSDate().addTimeInterval(TIME_QUANTUM) as NSDate
26+
NSRunLoop.mainRunLoop.runUntilDate(date)
27+
28+
loop.processNextEvent()
29+
}
30+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
2+
3+
package io.ktor.test.dispatcher
4+
5+
import kotlinx.coroutines.*
6+
import kotlin.coroutines.*
7+
import platform.Foundation.*
8+
9+
/**
10+
* Amount of time any task is processed and can't be rescheduled.
11+
*/
12+
private const val TIME_QUANTUM = 0.01
13+
14+
/**
15+
* Test runner for native suspend tests.
16+
*/
17+
actual fun testSuspend(
18+
context: CoroutineContext,
19+
block: suspend CoroutineScope.() -> Unit
20+
): Unit = runBlocking {
21+
val loop = coroutineContext[ContinuationInterceptor] as EventLoop
22+
23+
val task = launch { block() }
24+
while (!task.isCompleted) {
25+
val date = NSDate().addTimeInterval(TIME_QUANTUM) as NSDate
26+
NSRunLoop.mainRunLoop.runUntilDate(date)
27+
28+
loop.processNextEvent()
29+
}
30+
}

0 commit comments

Comments
 (0)