https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

Edoardo Luppi

10/23/2023, 10:23 AM
@mbonnin was looking at your comment here https://github.com/JetBrains/kotlin-web-site/pull/3789#discussion_r1362167198 So basically in 2.0 multiple targets will become an error at build time, correct? I've looked at the markdown documentation and basically it says we should split it into projects
Copy code
include(":okhttp-impl")
include(":ktor-impl")
However I don't understand what this means at build time. Wouldn't the expected output be totally different compared to the two targets?
m

mbonnin

10/23/2023, 10:39 AM
What do you mean by 'expected output' ? The publications will likely be different but the bytecode can be quite similar I guess
e

Edoardo Luppi

10/23/2023, 10:40 AM
I mean that two targets are completely different compared to two subprojects. With two targets, I can build them separately.
That's why I don't understand the document tbh.
m

mbonnin

10/23/2023, 10:42 AM
It's 3 subprojects if I read the markdown correctly
Instead of compiling sourcesets, you compile projects
This could work but the loss of expect/actual is sad
e

Edoardo Luppi

10/23/2023, 10:50 AM
But two targets result in different Gradle tasks. I can have
jvmTarget1Jar
and
jvmTarget2Jar
for example
m

mbonnin

10/23/2023, 10:51 AM
Different projects also do different tasks
e

Edoardo Luppi

10/23/2023, 10:56 AM
Mmh ok, still trying to map it to a real use case but I get what you're saying.
This is confusing 😆
m

mbonnin

10/23/2023, 10:56 AM
I'm with you here, multiple targets was handy and not sure how to replace the expect/actual
e

Edoardo Luppi

10/23/2023, 10:58 AM
Also I was thinking about non-JVM targets. A JS target bundles everything into a single package. So with the above example you'd end up with a package that contains both implementations I suppose.
Ah no wait. Same as JVM
Because the build task is started from one or the other project. I mean I was looking at multiple targets as a sort of C preprocessor directives. Not sure if it was making sense tho