kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Build fails on master

Open timmc opened this issue 1 year ago • 5 comments

Describe the bug

Running the documented ./gradlew build on master fails. (However, ./gradlew jvmTest succeeds.)

To Reproduce

  1. Checked out master branch (currently e6fb4402da80)
  2. Ran ./gradlew build

Two JS-related targets fail to compile:

> Task :kotlinx-serialization-core:compileKotlinJs
e: Could not load module <org.jetbrains.kotlinx:kotlinx-serialization-core> in an attempt to find deserializer for symbol kotlinx.serialization.internal/createSimpleEnumSerializer|createSimpleEnumSerializer(kotlin.String;kotlin.Array<0:0>){0§<kotlin.Enum<0:0>>}[0].

> Task :kotlinx-serialization-core:compileKotlinJs FAILED

> Task :kotlinx-serialization-core:compileKotlinWasmJs
e: Could not load module <org.jetbrains.kotlinx:kotlinx-serialization-core> in an attempt to find deserializer for symbol kotlinx.serialization.internal/createSimpleEnumSerializer|createSimpleEnumSerializer(kotlin.String;kotlin.Array<0:0>){0§<kotlin.Enum<0:0>>}[0].

> Task :kotlinx-serialization-core:compileKotlinWasmJs FAILED

Full output: gradle.log

Expected behavior

Project should build.

Environment

  • Kotlin version: 1.9.22 (compiler version indicated in Gradle output)
  • Library version: master, e6fb4402da8 (v1.6.3 + a few commits)
  • Kotlin platforms: All
  • Gradle version: 7.6.1
  • IDE version: N/A
  • Other relevant context: Debian Linux 12 (bookworm) x86-64; OpenJDK 17

timmc avatar May 05 '24 12:05 timmc

Shutting down IntelliJ IDEA first and running ./gradlew clean build gives a different error (also present on v1.6.3):

> Task :guide:test

example.test.SerializersTest > testExampleSerializer18 FAILED
    java.lang.Exception at SerializersTest.kt:129

120 tests completed, 1 failed

So the first one I saw may have been spurious, but there's still a build failure here.

timmc avatar May 05 '24 13:05 timmc

The compileKotlinJs fail is a known flaky issue of incremental compilation. It usually pops out when you switch branches that were too far apart. :kotlinx-serialization-core:clean usually makes the problem go away

sandwwraith avatar May 06 '24 09:05 sandwwraith

For ./gradlew :guide:test — I've tested both master and v.1.6.3, and they're passing fine (CI also shows the same: https://teamcity.jetbrains.com/buildConfiguration/KotlinTools_KotlinxSerialization_RuntimeLibraryBuildAggregated?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds).

However, given that this test is related to the date formatting, maybe there's an issue connected with the default locale on your machine. Can you please send a full exception text so I can check it?

sandwwraith avatar May 06 '24 09:05 sandwwraith

Oh yes, that's definitely a locale issue!

java.lang.Exception: Output is not the same as expected, difference is
-------------------------------------------
1c1
< {"stableReleaseDate":"2016-02-15","lastReleaseTimestamp":1657152000000}
---
> {"stableReleaseDate":"2016-02-14","lastReleaseTimestamp":1657152000000}
-------------------------------------------
	at kotlinx.knit.test.KnitTestKt.verifyOutputLines(KnitTest.kt:60)
	at example.test.SerializersTest.testExampleSerializer18(SerializersTest.kt:129)

format.parse("2016-02-15+00") gives Sun Feb 14 19:00:00 EST 2016 on my machine, and yes, I'm in the US Eastern locale. The example code should probably be updated to ensure a specific locale is used for serialization—I'd be happy to put in a PR that just sets the time zone to UTC on the formatter.

timmc avatar May 06 '24 13:05 timmc

I've filed https://github.com/Kotlin/kotlinx.serialization/pull/2664 for the date formatting issue. With that fixed, I can complete the build!

timmc avatar May 06 '24 14:05 timmc