-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans to support Kotlin Native? #40
Comments
That would be great to do at some point. I think most of the work would involve rewriting |
I have a working prototype of a multi-platform project with native support for windows and linux targets in the multiplatform branch. There's no OSX target, because I don't have a Mac computer, and cross-compilation for OSX targets is not supported (apparently due to legal reasons, so I don't expect that support to be added.) There are a few things holding me back from releasing it: There are some dokka bugs causing broken API doc output, and I haven't yet managed to set up publishing. I also haven't reimplemented the file editing functionality for the native targets, although I would be ok with simply documenting its absence, since I don't think it a commonly used feature. If anyone is interested in trying it out, you should be able to checkout that branch, build the clikt klib from source and include it manually. |
I would love the mpp version |
I checked out the multiplatform branch, you also need a JS target to be multiplatform....even if the functions are filled with TODO() |
I can confirm. The way the kotlin multiplatform plugin works for native is to generally expect it to only compile a target if the machine is that target platform. I worked on cross-platform Gradle build work for a multi-platform product in my job and while we hadn't gotten to Native support, I was recon-ing it (so this knowledge comes out of my recon from a few months ago, though things are moving fast). Since mac is a POSIX system, all you need to do is make sure that the code for linux is POSIX compatible and it should work nearly everywhere. If you have the need to actually release mac target packages (in general), you just need a contributor who owns a mac to trigger your publishing pipeline for that target. Pretty easy once it is all setup. |
@ajalt Maybe that's all what you need to build on a system that you don't have |
@dkotrada @dhakehurst @jmfayard @fuzzyweapon I just released a beta of the next version of Clikt, which has full multiplatform support. This version implements all functionality for JVM, NodeJS, and native Windows, Linux, and MacOS. For all non-JVM MPP targets, you can use this dependency:
It would be very helpful if anyone is able to try it out and let me know if it works for you. You can comment here or DM me on the ASG or kotlinlang slack. Thank you! |
@ajalt I tried the kmpp dependency for clikt. I was able to sync gradle with that dependencies and build the binary but the library doesn't seem to be on the IDE's classpath and I don't get autocompletion when editing a .kt file with the Clikt library. Additionally, if I type out the import statements and the Clikt classes manually and try to compile, I still get a compilation error - I don't think the issue is with the ide's classpath specifically. Any ideas? Thanks! plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
}
repositories {
mavenCentral()
}
kotlin {
// For ARM, should be changed to iosArm32 or iosArm64
// For Linux, should be changed to e.g. linuxX64
// For MacOS, should be changed to e.g. macosX64
// For Windows, should be changed to e.g. mingwX64
macosX64("macos") {
binaries {
executable {
// Change to specify fully qualified name of your application's entry point:
entryPoint = 'sample.main'
// Specify command-line arguments, if necessary:
runTask?.args('-o', 'foobar')
}
}
compilations["main"].enableEndorsedLibs = true
}
sourceSets {
// Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
// in gradle.properties file and re-import your project in IDE.
macosMain {
dependencies {
implementation("com.github.ajalt:clikt-multiplatform:2.5.0-beta1")
}
}
macosTest {
dependencies {
implementation("com.github.ajalt:clikt-multiplatform:2.5.0-beta1")
}
}
}
}
// Use the following Gradle tasks to run your application:
// :runReleaseExecutableMacos - without debug symbols
// :runDebugExecutableMacos - with debug symbols |
@yousuf-haque thank you for trying out the beta! Your gradle configuration looks fine; I'm able to get completion and builds working with that configuration on both Gradle 5.4 and 6.1. Here's an example project with a similar configuration to yours, which works in both IntelliJ and gradle: |
I am also using clikt native (linux). It work perfectly! Only difference I can see, is that I am using |
I updated to gradle 6.1.1( from 5.5.1) and that seemed to do the trick. Thanks! |
Clikt 2.5.0 has been released. Thank you to everyone who provided feedback! |
Would be great for CLI .
The text was updated successfully, but these errors were encountered: