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.
NewProjectDemo

Code Insight

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!
KotlinCodeInsight

Debugging

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!
debugging

Kotlin/Native Tests

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:
testing

What’s Next?

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!

This entry was posted in EAP, Native, Releases, Tools and tagged . Bookmark the permalink.

33 Responses to Kotlin/Native IDE Support Preview

  1. João Vitor Verona Biazibetti says:

    Will it be exclusive for CLion, or there are plans for also making it availabe on IDEA?

    • innov8 says:

      It would be ideal if all could run under Intellij. Quite reasonable if a CLion license is required to a CLion plugin – JetBrains has to have a revenue path so they can devote resources to the project… but still optimum if all projects can be under the same ide

    • Alexander Podkhalyuzin says:

      Main development is focused on CLion right now as we have lldb support in it and don’t have it in IntelliJ IDEA. As it’s just preview and we need to invest a lot of efforts to make it production ready, we don’t have any plans for IntelliJ IDEA right now, but I can’t say it’s impossible in future.

      • Michael Lawrence says:

        If you guys are serious about WASM support I would think WebStorm would be a viable candidate for IDE support as well. Being able to write my JS and Kotlin/WASM code in the same editor would be awesome. :)

  2. Markus says:

    Is there any writeup on how dependencies will be managed?
    Will there be some kind of package manager which can download artifacts (like maven for example) in the future?

    • Scellow says:

      +1 i hope a good package manager will be in place!

    • Alexander Podkhalyuzin says:

      We are going to support it in some way, but currently we don’t have answers even what to distribute, if it should be sources, binaries or even something else. But this is definitely what we actually want to have, so it’s going to be implemented.

  3. Maarten says:

    Can you say anything about a timeline for adding Kotlin/Native support to AppCode?

  4. Gordon says:

    Good work, thanks teams!

  5. Даниил Водопьян says:

    What build system will be the default for mixed projects? Gradle, CMake? What format will be used for native library distribution? Jars, something else?

    • Alexander Podkhalyuzin says:

      Currently native libraries uses own format ‘klib’. We don’t have information yet about package repositories for binaries/sources (or something else), so it’s just a file for now.
      Currently Kotlin/Native supported in both Gradle and CMake, however if you want to open project in CLion, you have to use CMake (it will be changed in future). So it means that mixed projects has to use both CMake and Gradle, however how such project should look we are not ready to tell yet, but work is in progress.

  6. Sergey says:

    How to is setting IDE?

  7. Augusto says:

    How garbage collector works in kotlin native?

  8. Frederic Janicki says:

    That sound great! Is there any samples of using this for MCU / Embedded development?

  9. kotliner says:

    Kotlin native is great! kotlin is the only language to support pc, mobile ,web(javascript, wasm).
    support PC: windows, linux, Mac OS
    support Mobile: iOS, android
    support Web: javascript and WASM

    but I hope kotlin support UWP also, what I means is the kotlin standard library for thread, network, and etc will support windows UWP(uwp is very different, don’t support normal c11 thread, tcp/ip socket, etc ). In fact, from 2020, almost all windows platform will support UWP.

    if kotlin standard library support pc , mobile , web and windows uwp from it’s beginning, then kotlin will be the only super language which support nearly all platform!

    kotlin is great!

    • nilof says:

      Reminder: the language supports many platforms, but most third-party libraries won’t. Library ecosystems are typically harder to learn than languages. Changing from Kotlin to Swift is effortless since the two are almost the same language, changing from Java ecosystem libraries to Objective-C ecosystem libraries is a much bigger adjustment.

  10. Mike says:

    OMG – Kotlin is really hot. Native support rocks.

  11. says:

    How to create Chinese-characters version kotlin?

  12. huodon says:

    Package manager +1

  13. Clancy says:

    It seems that currently Kotlin/Native uses “native” iOS controls. Is this a requirement or will it be possible to use the compiled Kotlin to access/port a lightweight UI framework like JavaFX?
    Will it be possible to utilise native C or C++ libraries in a Kotlin/Native app?
    Will it be truly cross-platform with eventual support for Windows, MacOS, Linux, iOS, Android and embedded with minimal platform-specific code?

    Performance of the KotlinConf app on my iPhone is awesome – well done!

    • Alexander Podkhalyuzin says:

      I can’t say if we are going to implement some lightweight UI framework or not as we don’t know yet ourselves too, so for now it’s requirement, but anything is possible in future.
      You can use native C library in Kotlin/Native app, but not C++.
      It’s not intended to be truly cross-platform for now as it’s much more complicated task. However I’m pretty sure that in future JetBrains together with community will implement lots of platform-independent Kotlin libraries especially for Android/iOS.

  14. david says:

    Package manager ++
    More powerful construction tool

  15. Krzysztof says:

    When Windows will be supported would I be able to create dlls libraries? If so – when?

    • Alexander Podkhalyuzin says:

      Windows in CLion is going to be supported soon, however I can’t say the same about dlls. It’s under active development, but if it’s going to be in Kotlin/Native 0.5 or not, I can’t say, as it’s too early for that.

  16. Wyatt says:

    I understand that Kotlin/Native is very new and experimental right now, but once you have pushed past the current set of hurdles, when do you think performance optimization can become the focus? With LLVM’s atom structure and information available from Kotlin semantics, you could probably squeeze some radical optimizations out of this. Any projections on when you might match or exceed the current JVM performance with native code?

Leave a Reply

Your email address will not be published. Required fields are marked *