What’s the Gradle task to generate serializers? I ...
# serialization
r
What’s the Gradle task to generate serializers? I don’t see it in IDEA nor in the result of
gradle tasks
, but I do have the plugin
kotlin("plugin.serialization")
and everything compiles. It’s just that I don’t see them in IDEA
e
There’s no separate task. It is a compiler plugin, so serializers are generated by Kotlin compile tasks.
r
Well it just doesn’t work in my case
I can’t find the generated code in my build folder
But it somehow works. I also know that it was generated at some point
e
Does not work in what case? How do you compile your code?
r
I’m in native. My app is 100% Kotlin, compiled from XCode launching Gradle. XCode runs
./gradlew build
which should generate the serializers I think
e
It should, indeed, if you apply the serialization plugin
r
It compiles and runs without issue, it’s just that IDEA doesn’t see the serializers and I don’t see them either in the build folder
e
It means that plugin was not picked up by IDEA. Check your Kotlin plugin version first.
r
I’m on 1.3.61 in Gradle, 1.3.61-release-AppCode-193.6015.49-14 in AppCode
e
When you say “IDEA does not see” do you mean AppCode does not see?
r
Same issue in both
I use AppCode sometimes because you can run the project directly from it, and I use IDEA sometimes because AppCode doesn’t understand Gradle
e
Can you share your build files? Also cc @sandwwraith
r
Actually after reimporting Gradle in IDEA it removes all the red. It’s not doing that in AppCode
So there’s a difference
My build file is too complex but starts with
Copy code
plugins {
    kotlin("multiplatform") version Versions.kotlin
    kotlin("plugin.serialization") version Versions.kotlin
    id("com.github.ben-manes.versions") version Versions.versionsGradlePlugin
}
Then in my dependencies I have
"iosMainApi"("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.serialization}")
If I close IDEA and open the project back in AppCode, the red comes back. So there’s an issue with AppCode / AppCode’s Kotlin Plugin
e
It could be.
r
Well I recently stopped being able to start the project from AppCode because of another K/N bug anyway, so RIP. I’ll use IDEA
s
I'm not sure serialization plugin is supposed to work in AppCode
😮 1
Btw, serialization plugin does not generate .kt files; it emits bytecode/native code directly inside compiler pass
🆗 1
Filed https://youtrack.jetbrains.com/issue/KT-36820. You can check whether I described your case correctly
👍 1
r
Thanks!