Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

How can I setup kotlin-native with intellij #474

Closed
wenerme opened this issue Apr 12, 2017 · 18 comments
Closed

How can I setup kotlin-native with intellij #474

wenerme opened this issue Apr 12, 2017 · 18 comments

Comments

@wenerme
Copy link

wenerme commented Apr 12, 2017

Is it possible to setup kn with intellij, or how you gays write kotlin native, without ide support ?

@vvlevchenko
Copy link
Contributor

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.

@wenerme
Copy link
Author

wenerme commented Apr 13, 2017

I can import the sample, but how to setup kotlin-native libs and autocomplete ?

@vvlevchenko
Copy link
Contributor

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.

@wenerme
Copy link
Author

wenerme commented Apr 13, 2017

😳
Can you setup a sample project with intellij and post the zip file here ? or create a demo repo for beginners.Many thanks, 🙏

@vvlevchenko
Copy link
Contributor

vvlevchenko commented Apr 13, 2017

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)

@vvlevchenko
Copy link
Contributor

if you need more assistance please fill free to reopen issue

@wenerme
Copy link
Author

wenerme commented Apr 13, 2017

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

@wenerme
Copy link
Author

wenerme commented Apr 13, 2017

@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

@olonho
Copy link
Contributor

olonho commented Apr 13, 2017

The typeOf problem was recently fixed, IIRC. Also commercial IDE for Kotlin/Native is being considered.

@Scellow
Copy link

Scellow commented Apr 13, 2017

@vvlevchenko Added macOS support in original repo perses-games/konan-sfml#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

@perses-games
Copy link

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

@ghost
Copy link

ghost commented Jun 3, 2017

@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?

@ghost
Copy link

ghost commented Jun 3, 2017

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

@napperley
Copy link
Contributor

@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).

  • How accessible is Kotlin Native going to be for a software developer/student/enthusiast in regards to tooling?
  • Will IntelliJ be an IDE for Kotlin Native development?
  • Is it true that JetBrains are working on developing a new Kotlin Native IDE (does it support all major desktop platforms - Linux, Windows, MacOS)?
  • Have JetBrains considered the Linux desktop where it has significant market share in some niche markets (eg 3D modelling, professional movie making, embedded software development ...), and how Kotlin Native (including tooling) fits into that?

@perses-games
Copy link

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

@ghost
Copy link

ghost commented Jun 3, 2017 via email

@Scellow
Copy link

Scellow commented Jun 4, 2017

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

@napperley
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants