Is it possible to setup kn with intellij, or how you gays write kotlin native, without ide support ?
We use intellij gradle integration in development. you can try yourself import gradle project from our samples. This the only method known for today, later IDE will support kotlin naive more natively and smooth.
I can import the sample, but how to setup kotlin-native libs and autocomplete ?
you can create similar gradle build script for your project and bindings to your library appears in your idea project immediately after cinteropt phase of build completed.
馃槼
Can you setup a sample project with intellij and post the zip file here ? or create a demo repo for beginners.Many thanks, 馃檹
here you can find fork of public kotlin-native project enriched with gradle build (it macish at this stage, but enough to illustrate how to modify for your platform)
if you need more assistance please fill free to reopen issue
I try to compile the latest but got this
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':tools:helpers:compileClasspath'.
> Could not find org.jetbrains.kotlin:kotlin-compiler:1.1-20170409.165958-449.
Searched in the following locations:
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-compiler/1.1-SNAPSHOT/kotlin-compiler-1.1-20170409.165958-449.pom
https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-compiler/1.1-SNAPSHOT/kotlin-compiler-1.1-20170409.165958-449.jar
http://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/kotlin/kotlin-compiler/1.1-SNAPSHOT/kotlin-compiler-1.1-20170409.165958-449.pom
http://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/kotlin/kotlin-compiler/1.1-SNAPSHOT/kotlin-compiler-1.1-20170409.165958-449.jar
Required by:
project :tools:helpers
@vvlevchenko Finally I compiled konan-sfml, but still can not run this
$ ./HelloSfml.kexe
Uncaught exception from Kotlin's main: Throwable: typeOf() is called with erased argument
at 0 HelloSfml.kexe 0x000000010b0492f9 kfun:kotlin.Throwable.<init>(kotlin.String?;kotlin.Throwable?)Reference + 121
at 1 HelloSfml.kexe 0x000000010b0594ca kfun:kotlinx.cinterop.readValueT.()Reference + 58
at 2 HelloSfml.kexe 0x000000010b044653 kfun:sfml.sfColor_fromRGB$lambda-164$bound-175#internal + 419
at 3 HelloSfml.kexe 0x000000010b0581b0 kfun:kotlinx.cinterop.memScoped(kotlin.Function1<kotlinx.cinterop.MemScope,GENERIC>)Reference + 352
at 4 HelloSfml.kexe 0x000000010b04441b kfun:sfml.sfColor_fromRGB(kotlin.Byte;kotlin.Byte;kotlin.Byte)Reference + 491
at 5 HelloSfml.kexe 0x000000010b043499 Konan_main + 2889
at 6 libdyld.dylib 0x00007fffbf71e255 start + 1
The typeOf problem was recently fixed, IIRC. Also commercial IDE for Kotlin/Native is being considered.
@vvlevchenko Added macOS support in original repo https://github.com/perses-games/konan-sfml/pull/1
I was looking for sfml lib, thanks for mentioning it :D :D kotlin is the best language ever, thanks for your hard work <3
@wenerme To work around the typeOf issue, I used the command line build (see: konan-sfml).
To have autocomplete in intellij I created a kotlin jvm project and added the Runtime.jar to the dependencies and the interop kotlin files to the sources (don't link the gradle build file). And then I build with the build script, this works for me. I'll switch to gradle once the typeOf issue is fixed there.
@perses-games Can't seem to get autocomplete to work for generated koltin. I don't know what I'm doing wrong.Can you describe the steps taken to import kotlin native samples?
@olonho Will there be an IntelliJ community plugin for koltin native? (it might seem selfish) Because they only work I do with IntelliJ IDE would be to build some OSS for elementary os using gtk bindings.
@olonho Will there be an IntelliJ community plugin for koltin native? (it might seem selfish) Because they only work I do with IntelliJ IDE would be to build some OSS for elementary os using gtk bindings.
As @harisvsulaiman has mentioned above some major Linux distros (eg Linux Mint) may want to use Kotlin Native to develop supporting GUI tools/utilities. If IntelliJ Community edition doesn't support Kotlin Native then that is likely to put in a barrier (show stopper), which prevents Linux distros from using Kotlin Native (think licensing issues with tooling).
@harisvsulaiman I added the generated file as a source file in the project settings in intellij. If you take a look at the settings in the sfml example project (https://github.com/perses-games/konan-sfml) you will see that the sfml.kt file is added to the project as a source file.
Thank you. Hopefully, I'll get it working. 馃槈
I also hope there will be a plugin for IDEA or CLion for people who don't need the whole multiplatform thing and just want to develop with kotlin native, similar to the Rust/Swift one just basic stuff
@Scellow - Hopefully if a IntelliJ plugin is produced then it can be used in the Community edition, not just the Ultimate edition. Somehow I think if some of the major Linux distros are involved with Kotlin Native then they WILL want Kotlin Native support in IntelliJ Community edition.
Most helpful comment
As @harisvsulaiman has mentioned above some major Linux distros (eg Linux Mint) may want to use Kotlin Native to develop supporting GUI tools/utilities. If IntelliJ Community edition doesn't support Kotlin Native then that is likely to put in a barrier (show stopper), which prevents Linux distros from using Kotlin Native (think licensing issues with tooling).