-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Kotlin/Native Support #45
Comments
Pull request is welcome. Any plan to do so? |
@oshai not so soon but I will when I develop Kotlin/Native app and if nobody else not started yet. |
@olonho @ilmat192 @homuroll @vvlevchenko is there any plan in Kotlin/Native support logging like this? |
+1 for KN logging! Thanks! |
We would love to see such support, and probably |
It seems that it may be a reasonable solution to build a wrapper to Log4C to cover Linux, macOS and Windows |
Would love that, any work in progress or detailed plan? |
The author agreed to contribute his implementation to this project, but doesn't have time to do so, so someone should take it if his hands. |
I was working on a project which had a linux x64 native component, and utilized kotlin logging. I started a patch noted below. To add in this support. I am basing this off of zf_log. I chose this due to it's small base, and ability to work across linux, iOs, android, and macos. That being said I'm new to kotlin native and cInterop. So may have some issues, or doing bad practice. I'm building the initial code in the area below. I based this off the 1.7.8 tag. |
@animusnull thanks for working on that! I am not working with kotlin native so don't think I will be able to provide any assistance. I suggest that you open the pull request in github so it will be possible to merge when ready. |
I've sort of hit a wall on figuring out how to publish the artifacts for linux native via kts. Once I get that sorted I'll look into how to submit a merge request. |
I just opened the MR. The solution was including a static lib. Which means compiling the lib ahead of time and bundling it with the artifact. I opened a topic on kotlin discussions about best practices regarding this. If we don't want to go that route then we can roll our own via println or something similar. |
@animusnull thanks for working on #103 I will try to review it as much as I can. |
Link to upstream https://discuss.kotlinlang.org/t/kotlin-native-static-library-best-practices/15487 This is also a slack discussion where I got help on the initial issue https://kotlinlang.slack.com/archives/C19FD9681/p1576614318012300 |
Guys, any plans to support KN? |
There is a open pull request. I have artifacts on my CI/CD pipeline for linux. I just haven't had time to finish it up recently. It needs Windows, MacOs, and iOS. The HostManager in gradle throws an exception when opening the project outside of Linux which I consider a breaking feature. |
see #103 |
Regarding #103 wouldn't it be better to take advantage of the syslog capabilities on each platform? With that PR you'd only get console logging capabilities. For instance on Android, kotlin-logging could just delegate to https://developer.android.com/reference/android/util/Log and on Apple platforms delegate to the Unified Logger: https://developer.apple.com/documentation/os/logging |
I think it makes sense. I see #103 as a default that can be override for each specific platform. |
It seems like for mobile we should use whatever native logging facility is open. For Linux native while I initially used a lib. I ended up going with a standard console out formatter. There isn't file out support, but I don't see a need too. For mobile those look like the two best options. I'm not a mobile dev, so wouldn't be familiar enough to implement it. |
Looks as though no actual progress has been made on adding support for the linuxX64 target. I have an alternative implementation for supporting the linuxX64 target, which only relies on the Kotlin Native Standard library, and POSIX (standard on MOST Linux distributions, with Android being one of the main exceptions). The implementation is based on the existing JS one. Also my implementation builds fine without any errors on a Linux X64 host, and can be published locally, although remote publishing hasn't been tested. |
Logging on mobile platforms is very different from Linux X64 and Linux ARM platforms. The biggest mistake made with pull #103 is the mobile platforms support which shouldn't be applied to linuxX64. Both the Linux X64, and Linux ARM platforms handle logging exactly the same, or at least they are nearly identical. It would make sense to have a common source set that is shared between the linuxX64, linuxArm32Hfp, and linuxArm64 targets but NOT the mobile platform targets (Android, iOS etc). |
Have managed to remotely publish my implementation to GitHub Packages without any errors. The GitHub Maven repository should be sufficient for testing purposes. Would welcome some feedback on my implementation. |
@napperley thanks! Since I am not working with native myself, I think the way to go is to create a PR and gather some comments, and later merge it and publish. |
Just closed my pr, hopefully that frees you up. I have linux packages as well. Looking at your build.gradle.kts are you depending on a native main? I saw that if consumed from another multi platform lib that targeted several platforms it needed native main. Not sure if they fixed that issue, as it's been a while since I've looked into this. |
@animusnull - Thank you for doing that 👍, that makes things easier. I highly appreciate the work you were trying to do with the PR ( #103 ). In the build.gradle.kts file there is no |
Just to update on the status: linux support was merged #119 but it still lacks deployed artifacts, and an assistance with that will be appreciated. |
The hmpp mode allows sharing single native sourceset across all native platforms. I checked and it works in my fork. |
Version 2.0.2 released with linux support. Main obstacle to release other natives artifact is in the build system. |
There's also GitHub Actions that can build on macOS and Windows in addition to Ubuntu. I can link an example open source Kotlin Multiplatform libraries project leveraging it if you want. |
Yes, thanks. |
@oshai There you have a workflow to check the project builds, and a workflow for releasing that also checks the pending publication upload before publishing the artifacts: https://github.com/LouisCAD/Splitties/tree/main/.github/workflows |
The publication checking depends on a module that is only included when passed the project property. Here's its |
If you like that approach, I can consider making a Gradle plugin for the multiplatform project pending publication checking part, and its publish triggering part (that needs a retry logic as you can see). It'd simplify Splitties codebase at the same time :) |
@LouisCAD we really need a plugin like that. I have my own set of plugins, which include publications as well, but I am not proficient with native yet. We can discuss it in slack. |
@LouisCAD seems like such a plugin can help a lot, if it's also possible to sync the repo to maven central after publich (via bintray) it can be awesome! (here is the api: https://bintray.com/docs/api/#_sync_version_artifacts_to_maven_central) |
As issue #21 was only dedicated for Kotlin/JVM and Kotlin/JS multi platform support, this issue is for Kotlin/Native support.
Kotlin/Native target platform is seen in
org.jetbrains.kotlin.konan.target.KonanTarget.kt
fileline 43 as of 2018 August 16th:
Above list can give idea for implementation for different platforms.
The text was updated successfully, but these errors were encountered: