curious how Konan and Kotlin gradle plugin will wo...
# kotlin-native
g
curious how Konan and Kotlin gradle plugin will work together in multiplatform/multimodule setup
1
i
The Kotlin/Native plugin works in the same manner as other platform plugins do. You add a dependency from a platform project to a common one and may set up custom common source sets for different artefacts.
a
@ilya.matveev Which means now the IDE will recognise the KN API? 🤩 Because it can solve them as dependencies in
build.gradle
?
g
@albertgao you can use dependencies to other modules even now, it’s gradle feature, so don’t think that something changed
a
@gildor Thanks for the answer. A little bit confused. Let’s say I want to
import platform.UIKit.*
. How to add this
platform.UIKit.*
to
build.gradle
?
g
It's not a dependency. It's platform library
It's available by default on particular platform. Not related to multiplatform anyway
For example you can use UIKit onluly on Mac, you cannot build it on Windows or Linux
a
I am using a Mac and build that already from the repo, how to get the building working? 😄 Do you mean that I need to use the building result from the KN repo?
g
Probably some bug, not sure. On sample project CLion and gradle can use platform libraries for me on mac
a
Yes, it works for CLion but that is from the CMake settings which I’m not familiar with, how could you add this dependency in gradle? Could you show the secret? 😄 Thanks
g
Just works for me
a
😅 So, what dependencies did you add in gradle?
g
no dependencies
a
kotlin-stb-lib, kotlin-native-gradle-plugin
😂oh, well
g
kotlin-native-gradle-plugin the only thing, but this is not a dependency, but gradle plugin
a
yes
I can’t build, gradle will say someting like can’t resolve the dependencies for
UIKit
g
Maybe some problem with your local K/N bundle
a
Yes, maybe. Not sure. Where do you put the project? inside the
kn repo\samples
? Or just a fresh new one, build with
kn-gradle-plugin
?
g
Which version kotlin-native-gradle-plugin do you use?
a
I have a fresh new one, everything works except for the platform specific API
0.5
😳 I should use 0.6 right?
g
0.6 not released officially
a
Just change to 0.6, and got this
Downloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler.
Seems positive
g
You should have this also on first run of 0.5
😂 1
a
Forgot, that’s a while ago
What does your
build.gradle
look like? Could you share it? 🙂