Skip to content

Commit

Permalink
Merge pull request #76 from simple-robot/dev/upgrade
Browse files Browse the repository at this point in the history
Update KSP, Kotlin coroutines and Kotlin serialization
  • Loading branch information
ForteScarlet authored Oct 31, 2024
2 parents 53a3ad9 + 00cc98d commit 288d094
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1,522 deletions.
82 changes: 29 additions & 53 deletions buildSrc/src/main/kotlin/JsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,22 @@
*/

import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension


inline fun KotlinJsTargetDsl.configJs(
nodeJs: Boolean = true,
browser: Boolean = true,
block: () -> Unit = {}
) {
if (nodeJs) {
nodejs()
// {
//// testTask {
//// useMocha {
//// timeout = "10000"
//// }
//// }
// }
}

if (browser) {
browser()
// {
// testTask{
// useKarma {
// useChromeHeadless()
// // useConfigDirectory(File(project.rootProject.projectDir, "karma"))
// }
// }
// }
nodejs {
testTask {
useMocha {
timeout = "10000"
}
}
}
}

binaries.library()
Expand All @@ -59,30 +42,24 @@ inline fun KotlinJsTargetDsl.configJs(
fun Project.configJsTestTasks() {
// val shouldRunJsBrowserTest = !hasProperty("teamcity") || hasProperty("enable-js-tests")
// if (shouldRunJsBrowserTest) return
tasks.findByName("cleanJsBrowserTest")?.apply {
onlyIf { false }
}
tasks.findByName("jsBrowserTest")?.apply {
onlyIf { false }
}
// tasks.findByName("cleanJsBrowserTest")?.apply {
// onlyIf { false }
// }
// tasks.findByName("jsBrowserTest")?.apply {
// onlyIf { false }
// }
}

inline fun KotlinWasmJsTargetDsl.configWasmJs(
nodeJs: Boolean = true,
browser: Boolean = true,
block: () -> Unit = {}
) {
if (nodeJs && isLinux) {
// win in candy node `21.0.0-v8-canary202309143a48826a08` is not supported
// nodejs()
}

if (browser) {
browser {
testTask{
useKarma {
useChromeHeadless()
// useConfigDirectory(File(project.rootProject.projectDir, "karma"))
nodejs {
testTask {
useMocha {
timeout = "10000"
}
}
}
Expand All @@ -93,18 +70,17 @@ inline fun KotlinWasmJsTargetDsl.configWasmJs(
}

inline fun Project.configWasmJsTest(block: () -> Unit = {}) {
if (false) {
// see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
rootProject.the<NodeJsRootExtension>().apply {
// nodeVersion = "21.0.0-v8-canary202309143a48826a08"
version = "21.0.0-v8-canary202309143a48826a08"
downloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
}

// if (false) {
// // see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
// rootProject.the<NodeJsRootExtension>().apply {
// // nodeVersion = "21.0.0-v8-canary202309143a48826a08"
// version = "21.0.0-v8-canary202309143a48826a08"
// downloadBaseUrl = "https://nodejs.org/download/v8-canary"
// }
//
// tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
// args.add("--ignore-engines")
// }
// }
block()
}
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin = "2.0.20"
kotlinx-coroutines = "1.8.1"
kotlinx-serialization = "1.7.1"
kotlinx-coroutines = "1.9.0"
kotlinx-serialization = "1.7.3"
kotlinx-datetime = "0.6.1"
dokka = "1.9.20"
ktor = "2.3.12"
Expand All @@ -13,7 +13,7 @@ simbot = "4.6.0"
suspendTransform = "2.0.20-0.9.3"
gradleCommon = "0.6.0"
# ksp
ksp = "2.0.10-1.0.24"
ksp = "2.0.20-1.0.25"
# https://square.github.io/kotlinpoet/
kotlinPoet = "2.0.0"
# https://mockk.io/
Expand Down
Loading

0 comments on commit 288d094

Please sign in to comment.