From d32376e036f82d599bf735f9378b0115e50ced35 Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Mon, 14 Oct 2024 16:13:23 +0100 Subject: [PATCH 1/7] update to ktor3 :warning: will no longer be compatible with ktor2 --- gradle/libs.versions.toml | 2 +- .../arrow/continuations/ktor/KtorServer.kt | 39 ++++++++----------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0d9c7f7..8adbcbb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ dokka = "1.9.20" arrowGradleConfig = "0.12.0-rc.6" kotlinBinaryCompatibilityValidator = "0.14.0" knit = "0.5.0" -ktor = "2.3.12" +ktor = "3.0.0" arrow = "1.2.4" [libraries] diff --git a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt index bf3ab95..f0b6a4a 100644 --- a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt +++ b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt @@ -4,6 +4,7 @@ import arrow.fx.coroutines.Resource import arrow.fx.coroutines.continuations.ResourceScope import io.ktor.server.application.* import io.ktor.server.engine.* +import io.ktor.util.logging.* import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @@ -18,14 +19,12 @@ import kotlinx.coroutines.delay * @param port Server listening port. Default is set to 80 * @param host Host address. Default is set to "0.0.0.0" * @param watchPaths specifies path substrings that will be watched for automatic reloading - * @param configure Ktor server configuration parameters. Only this function is taken into account - * for auto-reload. * @param preWait preWait a duration to wait before beginning the stop process. During this time, * requests will continue to be accepted. This setting is useful to allow time for the container * to be removed from the load balancer. This is disabled when `io.ktor.development=true`. * @param grace grace a duration during which already inflight requests are allowed to continue * before the shutdown process begins. - * @param timeout timeout a duration after which the server will be forceably shutdown. + * @param timeout timeout a duration after which the server will be forcibly shutdown. * @param module Represents configured and running web application, capable of handling requests. */ suspend fun < @@ -35,22 +34,14 @@ suspend fun < port: Int = 80, host: String = "0.0.0.0", watchPaths: List = listOf(WORKING_DIRECTORY_PATH), - configure: TConfiguration.() -> Unit = {}, preWait: Duration = 30.seconds, grace: Duration = 500.milliseconds, timeout: Duration = 500.milliseconds, module: Application.() -> Unit = {} -): ApplicationEngine = +): EmbeddedServer = install({ - embeddedServer( - factory, - host = host, - port = port, - watchPaths = watchPaths, - configure = configure, - module = module - ) - .apply(ApplicationEngine::start) + embeddedServer(factory, host = host, port = port, watchPaths = watchPaths, module = module) + .apply(EmbeddedServer::start) }) { engine, _ -> engine.release(preWait, grace, timeout) } @@ -61,36 +52,38 @@ suspend fun < * where we still handle requests instead of immediately cancelling any in-flight requests. * * @param factory Application engine for processing the requests - * @param environment definition of the environment where the engine will run + * @param rootConfig definition of the core configuration of the server, including modules, paths, + * and environment details. * @param preWait preWait a duration to wait before beginning the stop process. During this time, * requests will continue to be accepted. This setting is useful to allow time for the container * to be removed from the load balancer. This is disabled when `io.ktor.development=true`. * @param grace grace a duration during which already inflight requests are allowed to continue * before the shutdown process begins. - * @param timeout timeout a duration after which the server will be forceably shutdown. + * @param timeout timeout a duration after which the server will be forcibly shutdown. */ suspend fun < TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> ResourceScope .server( factory: ApplicationEngineFactory, - environment: ApplicationEngineEnvironment, + rootConfig: ServerConfig, configure: TConfiguration.() -> Unit = {}, preWait: Duration = 30.seconds, grace: Duration = 500.milliseconds, timeout: Duration = 500.milliseconds -): ApplicationEngine = - install({ embeddedServer(factory, environment, configure).apply(ApplicationEngine::start) }) { - engine, - _ -> +): EmbeddedServer = + install({ + embeddedServer(factory, rootConfig, configure) + .apply(EmbeddedServer::start) + }) { engine, _ -> engine.release(preWait, grace, timeout) } -private suspend fun ApplicationEngine.release( +private suspend fun EmbeddedServer<*, *>.release( preWait: Duration, grace: Duration, timeout: Duration ) { - if (!environment.developmentMode) { + if (!application.developmentMode) { environment.log.info( "prewait delay of ${preWait.inWholeMilliseconds}ms, turn it off using io.ktor.development=true" ) From ac3e12c6d8ad751d3e51cfe03a4e3f16c3988126 Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Mon, 14 Oct 2024 16:15:28 +0100 Subject: [PATCH 2/7] dump api update for switch to ktor3 --- suspendapp-ktor/api/suspendapp-ktor.api | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/suspendapp-ktor/api/suspendapp-ktor.api b/suspendapp-ktor/api/suspendapp-ktor.api index f0ecc0d..d4fb5cf 100644 --- a/suspendapp-ktor/api/suspendapp-ktor.api +++ b/suspendapp-ktor/api/suspendapp-ktor.api @@ -1,7 +1,7 @@ public final class arrow/continuations/ktor/KtorServerKt { - public static final fun server--IzA1Es (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/engine/ApplicationEngineEnvironment;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun server--IzA1Es$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/engine/ApplicationEngineEnvironment;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun server-T7_icE8 (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;Lkotlin/jvm/functions/Function1;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun server-T7_icE8$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;Lkotlin/jvm/functions/Function1;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun server--IzA1Es (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun server--IzA1Es$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun server-2LLPA_o (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun server-2LLPA_o$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } From 2df1d96e17a93e13d55b05245b71423ccd3ace9d Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Wed, 27 Nov 2024 13:17:40 +0000 Subject: [PATCH 3/7] chore: prepare update to arrow 2 and kotlin 2.1 --- build.gradle.kts | 29 +-- example/build.gradle.kts | 11 +- gradle/libs.versions.toml | 8 +- kotlin-js-store/yarn.lock | 174 +++++++++--------- suspendapp-ktor/api/suspendapp-ktor.api | 8 +- suspendapp-ktor/build.gradle.kts | 22 +-- .../arrow/continuations/ktor/KtorServer.kt | 2 +- 7 files changed, 103 insertions(+), 151 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 19d6819..124b5c2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.kotlin.multiplatform) @@ -24,8 +24,8 @@ kotlin { // We set up custom targets rather than use Arrow Gradle Config for Kotlin, // Since we don't support all targets but only subset where having this behavior makes sense. jvm { - compilations.all { - kotlinOptions.jvmTarget = "1.8" + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 } } js(IR) { @@ -39,28 +39,11 @@ kotlin { macosX64() sourceSets { - val commonMain by getting { + commonMain { dependencies { api(libs.coroutines) } } - - val jvmMain by getting - val jsMain by getting - val mingwX64Main by getting - val linuxX64Main by getting - val macosArm64Main by getting - val macosX64Main by getting - val linuxArm64Main by getting - - create("nativeMain") { - dependsOn(commonMain) - linuxX64Main.dependsOn(this) - macosArm64Main.dependsOn(this) - macosX64Main.dependsOn(this) - mingwX64Main.dependsOn(this) - linuxArm64Main.dependsOn(this) - } } } @@ -85,10 +68,6 @@ tasks { } } - withType().configureEach { - kotlinOptions.jvmTarget = "1.8" - } - register("cleanDocs") { val folder = file("docs").also { it.mkdir() } val docsContent = folder.listFiles().filter { it != folder } diff --git a/example/build.gradle.kts b/example/build.gradle.kts index 838d48f..17d5bf3 100644 --- a/example/build.gradle.kts +++ b/example/build.gradle.kts @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.RELEASE plugins { - kotlin("multiplatform") + alias(libs.plugins.kotlin.multiplatform) } repositories { @@ -34,18 +34,11 @@ kotlin { } sourceSets { - val commonMain by getting { + commonMain { dependencies { implementation(project.rootProject) implementation(libs.arrow.fx) } } - - val jvmMain by getting - val jsMain by getting - val mingwX64Main by getting - val linuxX64Main by getting - val macosArm64Main by getting - val macosX64Main by getting } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8adbcbb..6d80c86 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,12 @@ [versions] -kotlin = "2.0.0" +kotlin = "2.1.0-RC2" coroutines = "1.8.1" dokka = "1.9.20" arrowGradleConfig = "0.12.0-rc.6" -kotlinBinaryCompatibilityValidator = "0.14.0" +kotlinBinaryCompatibilityValidator = "0.16.3" knit = "0.5.0" -ktor = "3.0.0" -arrow = "1.2.4" +ktor = "3.0.1" +arrow = "2.0.0-beta.3" [libraries] coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 1a45f5d..fc5fc1b 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -ansi-colors@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +ansi-colors@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== ansi-regex@^5.0.1: version "5.0.1" @@ -56,7 +56,7 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -browser-stdout@1.3.1: +browser-stdout@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== @@ -79,10 +79,10 @@ chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chokidar@3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== +chokidar@^3.5.3: + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== dependencies: anymatch "~3.1.2" braces "~3.0.2" @@ -115,22 +115,22 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -debug@4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== +debug@^4.3.5: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: - ms "2.1.2" + ms "^2.1.3" decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -diff@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +diff@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== emoji-regex@^8.0.0: version "8.0.0" @@ -142,7 +142,7 @@ escalade@^3.1.1: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-string-regexp@4.0.0: +escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -154,7 +154,7 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-up@5.0.0: +find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -194,7 +194,7 @@ glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@8.1.0: +glob@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -210,7 +210,7 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -he@1.2.0: +he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -267,13 +267,20 @@ is-unicode-supported@^0.1.0: resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== -js-yaml@4.1.0: +js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" +kotlin-web-helpers@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286" + integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw== + dependencies: + format-util "^1.0.5" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -281,7 +288,7 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -log-symbols@4.1.0: +log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -289,52 +296,40 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -minimatch@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" - integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== - dependencies: - brace-expansion "^2.0.1" - -minimatch@^5.0.1: +minimatch@^5.0.1, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: brace-expansion "^2.0.1" -mocha@10.3.0: - version "10.3.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.3.0.tgz#0e185c49e6dccf582035c05fa91084a4ff6e3fe9" - integrity sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg== - dependencies: - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.3" - debug "4.3.4" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "8.1.0" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "5.0.1" - ms "2.1.3" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - workerpool "6.2.1" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@2.1.3: +mocha@10.7.3: + version "10.7.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" + integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== + dependencies: + ansi-colors "^4.1.3" + browser-stdout "^1.3.1" + chokidar "^3.5.3" + debug "^4.3.5" + diff "^5.2.0" + escape-string-regexp "^4.0.0" + find-up "^5.0.0" + glob "^8.1.0" + he "^1.2.0" + js-yaml "^4.1.0" + log-symbols "^4.1.0" + minimatch "^5.1.6" + ms "^2.1.3" + serialize-javascript "^6.0.2" + strip-json-comments "^3.1.1" + supports-color "^8.1.1" + workerpool "^6.5.1" + yargs "^16.2.0" + yargs-parser "^20.2.9" + yargs-unparser "^2.0.0" + +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -399,10 +394,10 @@ safe-buffer@^5.1.0: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== +serialize-javascript@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== dependencies: randombytes "^2.1.0" @@ -435,18 +430,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-json-comments@3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -supports-color@8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -454,6 +442,13 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" @@ -461,15 +456,15 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -typescript@5.4.3: - version "5.4.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff" - integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg== +typescript@5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== -workerpool@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" - integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== +workerpool@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" + integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== wrap-ansi@^7.0.0: version "7.0.0" @@ -490,17 +485,12 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yargs-parser@20.2.4: - version "20.2.4" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== - -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-unparser@2.0.0: +yargs-unparser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== @@ -510,7 +500,7 @@ yargs-unparser@2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@16.2.0: +yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== diff --git a/suspendapp-ktor/api/suspendapp-ktor.api b/suspendapp-ktor/api/suspendapp-ktor.api index d4fb5cf..e75e1cc 100644 --- a/suspendapp-ktor/api/suspendapp-ktor.api +++ b/suspendapp-ktor/api/suspendapp-ktor.api @@ -1,7 +1,7 @@ public final class arrow/continuations/ktor/KtorServerKt { - public static final fun server--IzA1Es (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun server--IzA1Es$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun server-2LLPA_o (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun server-2LLPA_o$default (Larrow/fx/coroutines/continuations/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun server--IzA1Es (Larrow/fx/coroutines/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun server--IzA1Es$default (Larrow/fx/coroutines/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;Lio/ktor/server/application/ServerConfig;Lkotlin/jvm/functions/Function1;JJJLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun server-2LLPA_o (Larrow/fx/coroutines/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun server-2LLPA_o$default (Larrow/fx/coroutines/ResourceScope;Lio/ktor/server/engine/ApplicationEngineFactory;ILjava/lang/String;Ljava/util/List;JJJLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } diff --git a/suspendapp-ktor/build.gradle.kts b/suspendapp-ktor/build.gradle.kts index 5bd8cf1..7661e44 100644 --- a/suspendapp-ktor/build.gradle.kts +++ b/suspendapp-ktor/build.gradle.kts @@ -1,5 +1,7 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { - id(libs.plugins.kotlin.multiplatform.get().pluginId) + alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.arrowGradleConfig.formatter) alias(libs.plugins.arrowGradleConfig.publish) alias(libs.plugins.arrowGradleConfig.versioning) @@ -13,8 +15,8 @@ kotlin { // We set up custom targets rather than use Arrow Gradle Config for Kotlin, // Since we don't support all targets but only subset where having this behavior makes sense. jvm { - compilations.all { - kotlinOptions.jvmTarget = "1.8" + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 } } linuxX64() @@ -22,23 +24,11 @@ kotlin { macosX64() sourceSets { - val commonMain by getting { + commonMain { dependencies { api(libs.arrow.fx) api(libs.ktor.core) } } - - val jvmMain by getting - val linuxX64Main by getting - val macosArm64Main by getting - val macosX64Main by getting - - create("nativeMain") { - dependsOn(commonMain) - linuxX64Main.dependsOn(this) - macosArm64Main.dependsOn(this) - macosX64Main.dependsOn(this) - } } } diff --git a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt index f0b6a4a..852e918 100644 --- a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt +++ b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt @@ -1,7 +1,7 @@ package arrow.continuations.ktor import arrow.fx.coroutines.Resource -import arrow.fx.coroutines.continuations.ResourceScope +import arrow.fx.coroutines.ResourceScope import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.util.logging.* From a49db082c844ed08f333430ed12a0ac20ae75cf8 Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Wed, 27 Nov 2024 15:16:15 +0000 Subject: [PATCH 4/7] chore: bump to Kotlin 2.1.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6d80c86..aec0474 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.1.0-RC2" +kotlin = "2.1.0" coroutines = "1.8.1" dokka = "1.9.20" arrowGradleConfig = "0.12.0-rc.6" From b23062dd557ef2ce39771e4128c017a38420bc7e Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Thu, 5 Dec 2024 17:52:38 +0000 Subject: [PATCH 5/7] chore: update dependencies arrow 2.0.0 release --- gradle/libs.versions.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aec0474..618e85c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,18 +1,18 @@ [versions] kotlin = "2.1.0" -coroutines = "1.8.1" +coroutines = "1.9.0" dokka = "1.9.20" -arrowGradleConfig = "0.12.0-rc.6" +arrowGradleConfig = "0.12.0-rc.24" kotlinBinaryCompatibilityValidator = "0.16.3" knit = "0.5.0" ktor = "3.0.1" -arrow = "2.0.0-beta.3" +arrow = "2.0.0" [libraries] coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "knit" } -ktor-core = {module = "io.ktor:ktor-server-host-common", version.ref = "ktor"} -arrow-fx = {module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow"} +ktor-core = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" } +arrow-fx = { module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow" } [plugins] arrowGradleConfig-formatter = { id = "io.arrow-kt.arrow-gradle-config-formatter", version.ref = "arrowGradleConfig" } From a7a217dd5904667542559e92aa278cd0be765ab5 Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Thu, 5 Dec 2024 18:02:39 +0000 Subject: [PATCH 6/7] chore: bump ktor to 3.0.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 618e85c..c1de289 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ dokka = "1.9.20" arrowGradleConfig = "0.12.0-rc.24" kotlinBinaryCompatibilityValidator = "0.16.3" knit = "0.5.0" -ktor = "3.0.1" +ktor = "3.0.2" arrow = "2.0.0" [libraries] From 4576822966b0753569a1e64731887ec7afbfcb11 Mon Sep 17 00:00:00 2001 From: Phil Davies Date: Sun, 8 Dec 2024 21:34:06 +0000 Subject: [PATCH 7/7] style: apply spotless --- .../kotlin/arrow/continuations/ktor/KtorServer.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt index 852e918..24be879 100644 --- a/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt +++ b/suspendapp-ktor/src/commonMain/kotlin/arrow/continuations/ktor/KtorServer.kt @@ -28,8 +28,9 @@ import kotlinx.coroutines.delay * @param module Represents configured and running web application, capable of handling requests. */ suspend fun < - TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> ResourceScope - .server( + TEngine : ApplicationEngine, + TConfiguration : ApplicationEngine.Configuration +> ResourceScope.server( factory: ApplicationEngineFactory, port: Int = 80, host: String = "0.0.0.0", @@ -62,8 +63,9 @@ suspend fun < * @param timeout timeout a duration after which the server will be forcibly shutdown. */ suspend fun < - TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configuration> ResourceScope - .server( + TEngine : ApplicationEngine, + TConfiguration : ApplicationEngine.Configuration +> ResourceScope.server( factory: ApplicationEngineFactory, rootConfig: ServerConfig, configure: TConfiguration.() -> Unit = {},