Skip to content

Commit 239e65a

Browse files
committed
update kotlin to 2.3.10 and other dependencies. update gradle to 9. add workaround for karma reporter
1 parent 23dcafa commit 239e65a

5 files changed

Lines changed: 77 additions & 12 deletions

File tree

buildSrc/src/main/kotlin/convention.multiplatform-tests.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
2+
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
3+
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
4+
import tasks.KarmaReportWorkaround
25

36
plugins {
47
id("convention.kotlin")
@@ -28,11 +31,25 @@ kotlin.targets.configureEach {
2831
name.startsWith("ios") || name.startsWith("macos") -> {
2932
macOsAllTest.dependsOn(tasks.named("${name}Test"))
3033
}
34+
3135
name.startsWith("mingw") -> {
3236
windowsAllTest.dependsOn(tasks.named("${name}Test"))
3337
}
38+
3439
else -> {
3540
linuxAllTest.dependsOn(tasks.named("${name}Test"))
3641
}
3742
}
43+
}
44+
45+
val karmaReportWorkaround =
46+
tasks.register<KarmaReportWorkaround>("karmaReportWorkaround") {
47+
val nodeJsRootExtension = rootProject.extensions.getByType<NodeJsRootExtension>()
48+
dependsOn(nodeJsRootExtension.npmInstallTaskProvider)
49+
}
50+
51+
tasks.withType<KotlinJsTest> {
52+
if (name == "jsBrowserTest") {
53+
dependsOn(karmaReportWorkaround)
54+
}
3855
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package tasks
2+
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.file.RegularFileProperty
5+
import org.gradle.api.tasks.InputFile
6+
import org.gradle.api.tasks.OutputFile
7+
import org.gradle.api.tasks.TaskAction
8+
9+
/**
10+
* Applies a workaround for kotlin-karma-reporter to append new lines when flushing log messages
11+
*/
12+
abstract class KarmaReportWorkaround : DefaultTask() {
13+
@get:InputFile
14+
val karmaReporterFile: RegularFileProperty =
15+
project.objects
16+
.fileProperty()
17+
.convention(
18+
project.rootProject.layout.buildDirectory
19+
.file("js/node_modules/kotlin-web-helpers/dist/karma-kotlin-reporter.js"),
20+
)
21+
22+
@TaskAction
23+
protected fun applyWorkaround() {
24+
val reporterFile = karmaReporterFile.get().asFile
25+
logger.lifecycle("Applying karma reporter workaround to file: {}", reporterFile)
26+
val karmaReporterContent = reporterFile.readText()
27+
// We append add a new line after each log line to ensure we don't get large single line in the end
28+
// The line larger than 1MB cannot be parsed by TCServiceMessageOutputStreamHandler
29+
// https://github.com/JetBrains/kotlin/blob/679366a83f99851b42f64795f10ed803ff011c73/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/testing/TCServiceMessageOutputStreamHandler.kt#L25C16-L25C51
30+
val expectedWriteLine = "this.write(line); if (browserResult.log.length > 0) { self.write('\\n'); }"
31+
if (karmaReporterContent.contains(expectedWriteLine)) {
32+
// Alrady updated
33+
return
34+
}
35+
reporterFile.writeText(
36+
karmaReporterContent.replace(
37+
"this.write(line);",
38+
expectedWriteLine,
39+
),
40+
)
41+
}
42+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[versions]
2-
kotlin = "2.3.0"
3-
kotest = "6.0.4"
2+
kotlin = "2.3.10"
3+
kotest = "6.1.3"
44
detekt = "1.23.8"
55
okio = "3.16.4"
6-
serialization = "1.9.0"
6+
serialization = "1.10.0"
77
benchmark = "0.4.15"
88
openapi = "2026.1"
99
jackson = "2.20.1"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

kotlin-js-store/yarn.lock

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,11 @@ is-number@^7.0.0:
10901090
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
10911091
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
10921092

1093+
is-path-inside@^3.0.3:
1094+
version "3.0.3"
1095+
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
1096+
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
1097+
10931098
is-plain-obj@^2.1.0:
10941099
version "2.1.0"
10951100
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
@@ -1348,10 +1353,10 @@ mkdirp@^0.5.5:
13481353
dependencies:
13491354
minimist "^1.2.6"
13501355

1351-
1352-
version "11.7.2"
1353-
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.2.tgz#3c0079fe5cc2f8ea86d99124debcc42bb1ab22b5"
1354-
integrity sha512-lkqVJPmqqG/w5jmmFtiRvtA2jkDyNVUcefFJKb2uyX4dekk8Okgqop3cgbFiaIvj8uCRJVTP5x9dfxGyXm2jvQ==
1356+
1357+
version "11.7.5"
1358+
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.5.tgz#58f5bbfa5e0211ce7e5ee6128107cefc2515a627"
1359+
integrity sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==
13551360
dependencies:
13561361
browser-stdout "^1.3.1"
13571362
chokidar "^4.0.1"
@@ -1361,6 +1366,7 @@ [email protected]:
13611366
find-up "^5.0.0"
13621367
glob "^10.4.5"
13631368
he "^1.2.0"
1369+
is-path-inside "^3.0.3"
13641370
js-yaml "^4.1.0"
13651371
log-symbols "^4.1.0"
13661372
minimatch "^9.0.5"
@@ -1876,10 +1882,10 @@ type-is@~1.6.18:
18761882
media-typer "0.3.0"
18771883
mime-types "~2.1.24"
18781884

1879-
1880-
version "5.9.2"
1881-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
1882-
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
1885+
1886+
version "5.9.3"
1887+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
1888+
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
18831889

18841890
ua-parser-js@^0.7.30:
18851891
version "0.7.35"

0 commit comments

Comments
 (0)