diff --git a/arrow-libs/core/arrow-atomic/build.gradle.kts b/arrow-libs/core/arrow-atomic/build.gradle.kts index 445ae20498d..24c46d57792 100644 --- a/arrow-libs/core/arrow-atomic/build.gradle.kts +++ b/arrow-libs/core/arrow-atomic/build.gradle.kts @@ -34,6 +34,7 @@ kotlin { commonTest { dependencies { implementation(projects.arrowFxCoroutines) + implementation(projects.arrowPlatform) implementation(libs.kotlin.test) implementation(libs.coroutines.test) implementation(libs.kotest.assertionsCore) diff --git a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicIntTest.kt b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicIntTest.kt index bb526f1c95a..3e923ef11bc 100644 --- a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicIntTest.kt +++ b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicIntTest.kt @@ -1,6 +1,7 @@ package arrow.atomic import arrow.fx.coroutines.parMap +import arrow.platform.stackSafeIteration import kotlin.test.Test import kotlinx.coroutines.test.runTest import io.kotest.matchers.shouldBe diff --git a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicLongTest.kt b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicLongTest.kt index b574c125f1a..eaa48f237ae 100644 --- a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicLongTest.kt +++ b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicLongTest.kt @@ -1,6 +1,7 @@ package arrow.atomic import arrow.fx.coroutines.parMap +import arrow.platform.stackSafeIteration import kotlin.test.Test import kotlinx.coroutines.test.runTest import io.kotest.matchers.shouldBe diff --git a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicTest.kt b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicTest.kt index 4df13754363..778dd19d344 100644 --- a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicTest.kt +++ b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/AtomicTest.kt @@ -1,6 +1,7 @@ package arrow.atomic import arrow.fx.coroutines.parMap +import arrow.platform.stackSafeIteration import kotlin.test.Test import kotlinx.coroutines.test.runTest import io.kotest.matchers.shouldBe diff --git a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/Platform.kt b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/Platform.kt index f83d3d325b5..fe1b3d28081 100644 --- a/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/Platform.kt +++ b/arrow-libs/core/arrow-atomic/src/commonTest/kotlin/arrow/atomic/Platform.kt @@ -1,17 +1,10 @@ package arrow.atomic -import io.kotest.common.Platform -import io.kotest.common.platform import kotlinx.coroutines.test.runTest import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.test.TestResult import kotlinx.coroutines.withContext -fun stackSafeIteration(): Int = when (platform) { - Platform.JVM -> 20_000 - else -> 1000 -} - fun runTestWithDelay(testBody: suspend () -> Unit): TestResult = runTest { withContext(Dispatchers.Default) { testBody() diff --git a/arrow-libs/core/arrow-core/build.gradle.kts b/arrow-libs/core/arrow-core/build.gradle.kts index ca137dabeda..c6a5d81ee8f 100644 --- a/arrow-libs/core/arrow-core/build.gradle.kts +++ b/arrow-libs/core/arrow-core/build.gradle.kts @@ -37,6 +37,7 @@ kotlin { commonTest { dependencies { implementation(projects.arrowFxCoroutines) + implementation(projects.arrowPlatform) implementation(libs.kotlin.test) implementation(libs.coroutines.test) implementation(libs.kotest.assertionsCore) diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptyListTest.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptyListTest.kt index 29023d96cab..44c402765cb 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptyListTest.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptyListTest.kt @@ -1,7 +1,7 @@ package arrow.core import arrow.core.test.nonEmptyList -import arrow.core.test.stackSafeIteration +import arrow.platform.stackSafeIteration import io.kotest.assertions.withClue import io.kotest.inspectors.shouldForAll import io.kotest.matchers.booleans.shouldBeTrue diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt index 32ff0ed45e2..8588f9e7309 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt @@ -1,7 +1,7 @@ package arrow.core import arrow.core.test.nonEmptySet -import arrow.core.test.stackSafeIteration +import arrow.platform.stackSafeIteration import io.kotest.assertions.withClue import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.nulls.shouldBeNull diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Platform.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Platform.kt deleted file mode 100644 index a308c4f8ad5..00000000000 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Platform.kt +++ /dev/null @@ -1,9 +0,0 @@ -package arrow.core.test - -import io.kotest.common.Platform -import io.kotest.common.platform - -fun stackSafeIteration(): Int = when (platform) { - Platform.JVM -> 200_000 - else -> 1000 -} diff --git a/arrow-libs/core/arrow-eval/build.gradle.kts b/arrow-libs/core/arrow-eval/build.gradle.kts index 85f4a155243..ee0313aed2d 100644 --- a/arrow-libs/core/arrow-eval/build.gradle.kts +++ b/arrow-libs/core/arrow-eval/build.gradle.kts @@ -34,6 +34,7 @@ kotlin { implementation(libs.kotlin.test) implementation(libs.kotest.assertionsCore) implementation(libs.kotest.property) + implementation(projects.arrowPlatform) } } } diff --git a/arrow-libs/core/arrow-eval/src/commonTest/kotlin/arrow/eval/EvalTest.kt b/arrow-libs/core/arrow-eval/src/commonTest/kotlin/arrow/eval/EvalTest.kt index 275d63ca2f0..f3d31b6322f 100644 --- a/arrow-libs/core/arrow-eval/src/commonTest/kotlin/arrow/eval/EvalTest.kt +++ b/arrow-libs/core/arrow-eval/src/commonTest/kotlin/arrow/eval/EvalTest.kt @@ -1,7 +1,6 @@ package arrow.eval -import io.kotest.common.Platform -import io.kotest.common.platform +import arrow.platform.stackSafeIteration import io.kotest.matchers.shouldBe import kotlin.test.Test @@ -24,11 +23,6 @@ private fun recur(limit: Int, sideEffect: SideEffect): (Int) -> Eval { } } -fun stackSafeIteration(): Int = when (platform) { - Platform.JVM -> 200_000 - else -> 1000 -} - class EvalTest { @Test fun mapWrappedValue() { diff --git a/arrow-libs/core/arrow-functions/build.gradle.kts b/arrow-libs/core/arrow-functions/build.gradle.kts index baf746a18a0..c7dd83d3897 100644 --- a/arrow-libs/core/arrow-functions/build.gradle.kts +++ b/arrow-libs/core/arrow-functions/build.gradle.kts @@ -33,6 +33,7 @@ kotlin { commonTest { dependencies { implementation(projects.arrowFxCoroutines) + implementation(projects.arrowPlatform) implementation(libs.kotlin.test) implementation(libs.coroutines.test) implementation(libs.kotest.assertionsCore) diff --git a/arrow-libs/core/arrow-functions/src/commonTest/kotlin/arrow/core/AndThenTests.kt b/arrow-libs/core/arrow-functions/src/commonTest/kotlin/arrow/core/AndThenTests.kt index d2c23ef2426..8a07c8ae025 100644 --- a/arrow-libs/core/arrow-functions/src/commonTest/kotlin/arrow/core/AndThenTests.kt +++ b/arrow-libs/core/arrow-functions/src/commonTest/kotlin/arrow/core/AndThenTests.kt @@ -1,7 +1,7 @@ package arrow.core -import io.kotest.common.Platform -import io.kotest.common.platform +import arrow.platform.Platform +import arrow.platform.platform import io.kotest.property.Arb import io.kotest.matchers.shouldBe import io.kotest.property.arbitrary.arbitrary diff --git a/arrow-libs/core/arrow-platform/api/arrow-platform.api b/arrow-libs/core/arrow-platform/api/arrow-platform.api new file mode 100644 index 00000000000..1a066c5a751 --- /dev/null +++ b/arrow-libs/core/arrow-platform/api/arrow-platform.api @@ -0,0 +1,18 @@ +public final class arrow/platform/CurrentPlatform { + public static final fun getPlatform ()Larrow/platform/Platform; +} + +public final class arrow/platform/Platform : java/lang/Enum { + public static final field JS Larrow/platform/Platform; + public static final field JVM Larrow/platform/Platform; + public static final field Native Larrow/platform/Platform; + public static final field WebAssembly Larrow/platform/Platform; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Larrow/platform/Platform; + public static fun values ()[Larrow/platform/Platform; +} + +public final class arrow/platform/PlatformKt { + public static final fun stackSafeIteration ()I +} + diff --git a/arrow-libs/core/arrow-platform/api/arrow-platform.klib.api b/arrow-libs/core/arrow-platform/api/arrow-platform.klib.api new file mode 100644 index 00000000000..912bfb4c3fd --- /dev/null +++ b/arrow-libs/core/arrow-platform/api/arrow-platform.klib.api @@ -0,0 +1,25 @@ +// Klib ABI Dump +// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, watchosArm32, watchosArm64, watchosSimulatorArm64, watchosX64] +// Rendering settings: +// - Signature version: 2 +// - Show manifest properties: true +// - Show declarations: true + +// Library unique name: +final enum class arrow.platform/Platform : kotlin/Enum { // arrow.platform/Platform|null[0] + enum entry JS // arrow.platform/Platform.JS|null[0] + enum entry JVM // arrow.platform/Platform.JVM|null[0] + enum entry Native // arrow.platform/Platform.Native|null[0] + enum entry WebAssembly // arrow.platform/Platform.WebAssembly|null[0] + + final val entries // arrow.platform/Platform.entries|#static{}entries[0] + final fun (): kotlin.enums/EnumEntries // arrow.platform/Platform.entries.|#static(){}[0] + + final fun valueOf(kotlin/String): arrow.platform/Platform // arrow.platform/Platform.valueOf|valueOf#static(kotlin.String){}[0] + final fun values(): kotlin/Array // arrow.platform/Platform.values|values#static(){}[0] +} + +final val arrow.platform/platform // arrow.platform/platform|{}platform[0] + final fun (): arrow.platform/Platform // arrow.platform/platform.|(){}[0] + +final fun arrow.platform/stackSafeIteration(): kotlin/Int // arrow.platform/stackSafeIteration|stackSafeIteration(){}[0] diff --git a/arrow-libs/core/arrow-platform/build.gradle.kts b/arrow-libs/core/arrow-platform/build.gradle.kts new file mode 100644 index 00000000000..e863afadf7b --- /dev/null +++ b/arrow-libs/core/arrow-platform/build.gradle.kts @@ -0,0 +1,44 @@ +@file:Suppress("DSL_SCOPE_VIOLATION") + +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + + +plugins { + id(libs.plugins.kotlin.multiplatform.get().pluginId) + alias(libs.plugins.arrowGradleConfig.kotlin) + alias(libs.plugins.publish) + alias(libs.plugins.spotless) +} + +spotless { + kotlin { + ktlint().editorConfigOverride(mapOf("ktlint_standard_filename" to "disabled")) + } +} + +apply(from = property("ANIMALSNIFFER_MPP")) + +kotlin { + sourceSets { + commonMain { + dependencies { + implementation(libs.kotlin.stdlib) + } + } + } + + jvm { + tasks.jvmJar { + manifest { + attributes["Automatic-Module-Name"] = "arrow.platform" + } + } + } + + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + (project.rootProject.properties["kotlin_language_version"] as? String)?.also { languageVersion = KotlinVersion.fromVersion(it) } + (project.rootProject.properties["kotlin_api_version"] as? String)?.also { apiVersion = KotlinVersion.fromVersion(it) } + } +} diff --git a/arrow-libs/core/arrow-platform/gradle.properties b/arrow-libs/core/arrow-platform/gradle.properties new file mode 100644 index 00000000000..e7cd93421f1 --- /dev/null +++ b/arrow-libs/core/arrow-platform/gradle.properties @@ -0,0 +1,2 @@ +# Maven publishing configuration +POM_NAME=Arrow Platform diff --git a/arrow-libs/core/arrow-platform/knit.properties b/arrow-libs/core/arrow-platform/knit.properties new file mode 100644 index 00000000000..696d68af60d --- /dev/null +++ b/arrow-libs/core/arrow-platform/knit.properties @@ -0,0 +1,5 @@ +knit.package=arrow.platform.examples +knit.dir=src/commonTest/kotlin/examples/ + +test.package=arrow.platform.examples.test +test.dir=src/commonTest/kotlin/examples/autogenerated/ diff --git a/arrow-libs/core/arrow-platform/src/commonMain/kotlin/arrow/platform/Platform.kt b/arrow-libs/core/arrow-platform/src/commonMain/kotlin/arrow/platform/Platform.kt new file mode 100644 index 00000000000..20446032579 --- /dev/null +++ b/arrow-libs/core/arrow-platform/src/commonMain/kotlin/arrow/platform/Platform.kt @@ -0,0 +1,18 @@ +package arrow.platform + +import kotlin.jvm.JvmName + +public enum class Platform { + JVM, JS, Native, WebAssembly +} + +public expect val platform: Platform + +/** + * Heuristic about the maximum amount of stack space + * one can reasonably consume in the executing platform. + */ +public fun stackSafeIteration(): Int = when (platform) { + Platform.JVM -> 200_000 + else -> 1000 +} diff --git a/arrow-libs/core/arrow-platform/src/jsMain/kotlin/arrow/platform/Platform.kt b/arrow-libs/core/arrow-platform/src/jsMain/kotlin/arrow/platform/Platform.kt new file mode 100644 index 00000000000..5a6a764e6ad --- /dev/null +++ b/arrow-libs/core/arrow-platform/src/jsMain/kotlin/arrow/platform/Platform.kt @@ -0,0 +1,3 @@ +package arrow.platform + +public actual val platform: Platform = Platform.JS diff --git a/arrow-libs/core/arrow-platform/src/jvmMain/kotlin/arrow/platform/PlatformJvm.kt b/arrow-libs/core/arrow-platform/src/jvmMain/kotlin/arrow/platform/PlatformJvm.kt new file mode 100644 index 00000000000..c44c0df3d14 --- /dev/null +++ b/arrow-libs/core/arrow-platform/src/jvmMain/kotlin/arrow/platform/PlatformJvm.kt @@ -0,0 +1,4 @@ +@file:JvmName("CurrentPlatform") +package arrow.platform + +public actual val platform: Platform = Platform.JVM diff --git a/arrow-libs/core/arrow-platform/src/nativeMain/kotlin/arrow/platform/Platform.kt b/arrow-libs/core/arrow-platform/src/nativeMain/kotlin/arrow/platform/Platform.kt new file mode 100644 index 00000000000..dcd67ab114c --- /dev/null +++ b/arrow-libs/core/arrow-platform/src/nativeMain/kotlin/arrow/platform/Platform.kt @@ -0,0 +1,3 @@ +package arrow.platform + +public actual val platform: Platform = Platform.Native diff --git a/arrow-libs/core/arrow-platform/src/wasmJsMain/kotlin/arrow/platform/Platform.kt b/arrow-libs/core/arrow-platform/src/wasmJsMain/kotlin/arrow/platform/Platform.kt new file mode 100644 index 00000000000..f69d838cae8 --- /dev/null +++ b/arrow-libs/core/arrow-platform/src/wasmJsMain/kotlin/arrow/platform/Platform.kt @@ -0,0 +1,3 @@ +package arrow.platform + +public actual val platform: Platform = Platform.WebAssembly diff --git a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts index 0289ac1dc07..dc909f0efc5 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts +++ b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts @@ -34,6 +34,7 @@ kotlin { dependencies { implementation(projects.arrowCore) implementation(projects.arrowAtomic) + implementation(projects.arrowPlatform) implementation(libs.kotlin.test) implementation(libs.coroutines.test) implementation(libs.kotest.assertionsCore) diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/ParMapTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/ParMapTest.kt index ead4d9c4bb8..7f635496ce3 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/ParMapTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/ParMapTest.kt @@ -6,6 +6,7 @@ import arrow.core.Either import arrow.core.NonEmptyList import arrow.core.left import arrow.core.raise.either +import arrow.platform.stackSafeIteration import io.kotest.matchers.should import io.kotest.matchers.shouldBe import io.kotest.property.Arb diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/Platform.kt b/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/Platform.kt index b516d7a1d5c..385707fbc60 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/Platform.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/commonTest/kotlin/arrow/fx/coroutines/Platform.kt @@ -1,7 +1,5 @@ package arrow.fx.coroutines -import io.kotest.common.Platform -import io.kotest.common.platform import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.test.TestResult import kotlinx.coroutines.test.TestScope @@ -10,11 +8,6 @@ import kotlinx.coroutines.withContext import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds -fun stackSafeIteration(): Int = when (platform) { - Platform.JVM -> 20_000 - else -> 1000 -} - // The normal dispatcher with 'runTest' does some magic // which doesn't go well with 'parZip', 'parMap', and 'raceN' fun runTestUsingDefaultDispatcher( diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/NamedThreadFactory.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/NamedThreadFactory.kt new file mode 100644 index 00000000000..6fb855ed919 --- /dev/null +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/NamedThreadFactory.kt @@ -0,0 +1,15 @@ +package arrow.fx.coroutines + +import arrow.atomic.AtomicInt +import java.util.concurrent.ThreadFactory + +private val namedThreadCount = AtomicInt(0) + +class NamedThreadFactory(val name: String): ThreadFactory { + override fun newThread(r: Runnable): Thread? = + Thread(r, "$name-${namedThreadCount.getAndIncrement()}").apply { + uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _, e -> + e.printStackTrace() + } + } +} diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip2JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip2JvmTest.kt index ff84fa64069..6de497bcb3b 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip2JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip2JvmTest.kt @@ -4,7 +4,6 @@ import arrow.core.Either import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import java.util.concurrent.Executors import kotlin.coroutines.CoroutineContext import kotlin.test.Test diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip3JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip3JvmTest.kt index 49ca6111e01..88c8430a7be 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip3JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip3JvmTest.kt @@ -4,7 +4,6 @@ import arrow.core.Either import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip4JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip4JvmTest.kt index f80bd554709..4888eb712d9 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip4JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip4JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple4 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt index 3562d9b300e..05ee6e991e2 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple5 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string @@ -13,7 +12,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.* import java.util.concurrent.Executors import kotlin.test.Test -import kotlin.time.Duration.Companion.seconds class ParZip5JvmTest { val threadName: suspend CoroutineScope.() -> String = diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip6JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip6JvmTest.kt index 6e327e9c2ee..5a76e9dd6b1 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip6JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip6JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple6 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string @@ -13,7 +12,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.* import java.util.concurrent.Executors import kotlin.test.Test -import kotlin.time.Duration.Companion.seconds class ParZip6JvmTest { val threadName: suspend CoroutineScope.() -> String = diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip7JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip7JvmTest.kt index 50a2a6b1176..601efc6ff3e 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip7JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip7JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple7 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string @@ -13,7 +12,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.* import java.util.concurrent.Executors import kotlin.test.Test -import kotlin.time.Duration.Companion.seconds class ParZip7JvmTest { val threadName: suspend CoroutineScope.() -> String = diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip8JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip8JvmTest.kt index 1d53c7c26cb..5f38d5c18ee 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip8JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip8JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple8 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string @@ -13,7 +12,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.* import java.util.concurrent.Executors import kotlin.test.Test -import kotlin.time.Duration.Companion.seconds class ParZip8JvmTest { val threadName: suspend CoroutineScope.() -> String = diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip9JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip9JvmTest.kt index ae7f86a2db2..73a0a81c6a4 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip9JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip9JvmTest.kt @@ -5,7 +5,6 @@ import arrow.core.Tuple9 import io.kotest.assertions.assertSoftly import io.kotest.matchers.should import io.kotest.matchers.string.shouldStartWith -import io.kotest.mpp.NamedThreadFactory import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.string @@ -13,7 +12,6 @@ import io.kotest.property.checkAll import kotlinx.coroutines.* import kotlin.test.Test import java.util.concurrent.Executors -import kotlin.time.Duration.Companion.seconds class ParZip9JvmTest { val threadName: suspend CoroutineScope.() -> String = diff --git a/arrow-libs/resilience/arrow-resilience/build.gradle.kts b/arrow-libs/resilience/arrow-resilience/build.gradle.kts index 4335b6a4f5f..0df872e9388 100644 --- a/arrow-libs/resilience/arrow-resilience/build.gradle.kts +++ b/arrow-libs/resilience/arrow-resilience/build.gradle.kts @@ -30,6 +30,7 @@ kotlin { commonTest { dependencies { implementation(projects.arrowFxCoroutines) + implementation(projects.arrowPlatform) implementation(libs.kotlin.test) implementation(libs.coroutines.test) } diff --git a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/CircuitBreakerTest.kt b/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/CircuitBreakerTest.kt index bebebdd2ddd..c1f0e3c87fa 100644 --- a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/CircuitBreakerTest.kt +++ b/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/CircuitBreakerTest.kt @@ -1,6 +1,7 @@ package arrow.resilience import arrow.core.Either +import arrow.platform.stackSafeIteration import arrow.resilience.CircuitBreaker.OpeningStrategy import arrow.resilience.CircuitBreaker.OpeningStrategy.SlidingWindow import kotlinx.coroutines.CompletableDeferred diff --git a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/Platform.kt b/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/Platform.kt deleted file mode 100644 index e99153d3b72..00000000000 --- a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/Platform.kt +++ /dev/null @@ -1,9 +0,0 @@ -package arrow.resilience - -import arrow.resilience.common.Platform -import arrow.resilience.common.platform - -fun stackSafeIteration(): Int = when (platform) { - Platform.JVM -> 20_000 - else -> 1_000 -} diff --git a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/ScheduleTest.kt b/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/ScheduleTest.kt index 3330d0ab1e0..6a4933181e7 100644 --- a/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/ScheduleTest.kt +++ b/arrow-libs/resilience/arrow-resilience/src/commonTest/kotlin/arrow/resilience/ScheduleTest.kt @@ -5,6 +5,7 @@ import arrow.atomic.updateAndGet import arrow.core.Either import arrow.core.left import arrow.core.right +import arrow.platform.stackSafeIteration import arrow.resilience.Schedule.Decision.Continue import arrow.resilience.Schedule.Decision.Done import kotlinx.coroutines.test.TestResult diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1dabf7855c3..0a01d1590e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ arrowGradleConfig = "0.12.0-rc.24" coroutines = "1.9.0" classgraph = "4.8.177" dokka = "1.9.20" -kotest = "5.9.1" +kotest = "6.0.0.M1" kover = "0.8.3" kotlin = "2.1.0-RC" kotlinBinaryCompatibilityValidator = "0.16.3" diff --git a/settings.gradle.kts b/settings.gradle.kts index 8500aca8674..c64f3b689ad 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -55,6 +55,9 @@ dependencyResolutionManagement { include("arrow-annotations") project(":arrow-annotations").projectDir = file("arrow-libs/core/arrow-annotations") +include("arrow-platform") +project(":arrow-platform").projectDir = file("arrow-libs/core/arrow-platform") + include("arrow-core") project(":arrow-core").projectDir = file("arrow-libs/core/arrow-core")