Something I am confused about: I am creating a Kot...
# kotlin-native
d
Something I am confused about: I am creating a Kotlin Native application in IDEA and it creates a build.gradle.kts with 'repositories { mavenCentral() }. I somehow expected the Kotlin Native code not to work with JVM code - why would it include the repository for JVM dependencies?
b
Maven artifact format is used to publish all kotlin libs, even native ones
MavenCentral is not just for jvm, bur rather for maven artefacts (which can be anything, not just jars)
d
So there are libraries with native (non-jvm) code on Maven central and they are fine with that?
b
Yes
d
I learned something new today. Always thought this was JVM only! Thanks.
šŸ‘ 2
This is my this years AoC challenge… going fully Kotlin-Native on that one.
b
Do one better, go fully metadata-only. I.e. all code in commonMain compiled for all platforms šŸ˜€
d
Could you explain what this means? (New to Kotlin Native, despite doing Kotlin for a while xD)
b
Are you familiar with kotlin multiplatform at all? It's a superset of kotlin native
d
I know what it is trying to archive, but no idea how it is done. That is one of my goals today evening. šŸ˜„
b
Well it's basically a way to write platform independent code and then compile it to whatever platform you want. Here's an example of multiplatform library that has only common code https://github.com/mpetuska/kon
You can also build multiplatform applications this way by configuring binaries
d
Using only code that can be compiled to native is one of my goals, yeah. Thought this is where I was heading… xD I'll take a look
e
I started to set my repository up for that MPP (JVM, JS, Native), but I couldn't get kotlinx-benchmark-runtime to link. may try again later
b
This expands on the concept and alliws you to compile the same code for jvm, android, nodejs and browser as well
e
but as it is you can create a multi-platform project with most or all code in common, e.g. https://github.com/ephemient/aoc2021/blob/main/kt/build.gradle.kts
l
I've been using K/JVM, but haven't used any JVM-only features yet. I didn't thnk of making it fully multiplatform. I'll have to try that.