Kotlin/Native IDE Support Preview
Kotlin/Native is a brand new technology that compiles Kotlin directly to machine code and produces executables that can run without a virtual machine. At KotlinConf 2017, we announced a preview release of development tools for Kotlin/Native.
While we have IntelliJ IDEA for working with Kotlin, Kotlin/Native integrates with technologies from the native world such as Clang and LLDB support. That’s why JetBrains’ choice for Kotlin/Native is CLion, our IDE for C and C++.
To get started, download and install CLion 2017.3 (note that this version is at the early access preview stage for now). Next, install two plugins from the JetBrains Plugin Repository. In CLion, choose Configure → Plugins → Install JetBrains plugin…, then find Kotlin and Kotlin/Native plugins there, and install them. Don’t forget this is still a technology preview and bugs are possible, but if you encounter any, please report them!
New Kotlin/Native Project
Learning a new technology requires a good entry point, and we’ve already prepared one for you. Create sample projects right from CLion and play with some simple code examples. Click *New Project → Kotlin/Native Application *and select one of the available samples. CLion will automatically download and install native packages on your computer as needed.
Kotlin/Native IDE support is based on the regular Kotlin plugin for IntelliJ IDEA. This means that you have all the specific code inspections, intentions, code completion actions and of course refactorings already available for Kotlin/Native!
The CLion plugin supports debugging, based on LLDB. Note this is still under active development and requires specific conditions (plus a bit of luck) to get working. Please do try it and let us know how it works for you!
The CLion plugin also supports running tests written using the kotlin.test framework. For the time being, to run a test, you need to create a ‘Kotlin/Native Test’ run configuration (under Run → Edit Configurations…) manually. Creating configurations from the editor popup menu will be supported in future updates.
Once you run the tests, you will see a nice test tree like this one:
IDE code insight, testing support, and a debugger are already a pretty solid tool-set, and we’ll continue to polish these features to make your experience as smooth as possible for the public release. However, it’s not everything we plan to offer with the first stable release of Kotlin/Native IDE support. We are also going to fully support interoperability with native libraries, with features such as documentation preview, cross-language navigation and, of course, refactorings.
Have a nice Kotlin/Native!
Subscribe to Blog updates
Thanks, we've got you!
Kotlin 1.9.20 Released
Kotlin 1.9.20 has been released! Highlights include: Kotlin K2 for all targets is in Beta, and Kotlin Multiplatform is Stable. Learn more!
Kotlin 1.9.0 Released
Kotlin 1.9.0 has been released! Highlights include: Kotlin K2 for JVM is in Beta, other K2 compiler updates, new enum class values function, new operator for open-ended ranges, preview of Gradle configuration cache in Kotlin Multiplatform, changes for Android target support in Kotlin Multiplatform, preview of custom memory allocator in Kotlin/Native. Learn more!
Introducing Kotlin Notebook
The first experimental version of the Kotlin Notebook plugin for IntelliJ IDEA is now available! This post will offer insight into the plugin’s functionality and use cases, but before launching into that, we’d like to let the plugin speak for itself: https://youtu.be/2PLYlDJPelQ W…