-
-
Notifications
You must be signed in to change notification settings - Fork 466
Add Kotlin/Native Wrapper #719
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
Conversation
First of all: I'm impressed. You had to develop your own gradle plugin to build cross-compiled cmake based native code?!? I had already a closer look at your code and it looks pretty good. There are a few things I'd like to see changed before merging, though. One is naming (see #705 and #720). I got a little distracted with that summary. I'll start with some detailed feedback tomorrow, hopefully. At the latest early next week. |
I develop my own gradle plugin because I hope to integrate the whole building progress into ci, but not to manually build every targets one by one and configure cross compile environment. And the plugin can also be used to binding other c-based library into K/N(Eventually KMP aka. Kotlin Multiplatform) For the issue of naming, I will correct them today and push them if everything goes well. What's more, I hope to get some idea about the package name of classes in the wrapper, is simple Edit: |
c24acde
to
d02ad4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot to cover. I'll just start and see how far I get today...
There are open questions regarding how to most naturally model the ReaderOptions, ImageView and BarcodeReader API.
Everything seems working well, include ci and tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the continued work on this.
wrappers/kn/src/nonAndroidNativeTest/kotlin/Test.nonAndroidNative.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are coming closer to a merge. Thank you.
wrappers/kn/src/nonAndroidNativeTest/kotlin/Test.nonAndroidNative.kt
Outdated
Show resolved
Hide resolved
Sorry for the inconvenience but my recent commit requires a number of changes before merging. |
Align old `Result` class name with zxing-cpp#705
CI: No more artifacts for kn build test
… the kotlin object was deleted to avoid memory lack
Thanks for your patience and endurance. :) Let's hope people find this useful. By the way: what is your use case for this? |
I'm currently working on an multiplatform app used for a student organization and it needs a library for scanning qrcodes. The next I will do is to try to unify this binding with many other non-native platforms such as |
@ISNing @axxel thank you for the work here, this looks amazing! We are more interested in the generation side of barcodes but it seems that this is not currently covered here. We'd be happy to contribute in this regard based on the excellent work done by @ISNing. Also just a quick question, you mention that this is available in Maven Central, but it seems it's not listed there yet. Does it need time to propagate? Or am I missing something? |
Steyn, Awesome work, |
That is correct.
Very good to know. Also nice to hear that someone (except for @ISNing) is actually interested in this new code :) The main reason the writing part is not present a.t.m. is basically because of this very dated initiative: #332. The current
That is correct. I have not done a release, yet. That is also tight to the #724 discussion, which I'd like to settle before the new Rust, .NET, K/N wrappers are properly released. |
I fully agree with @oehhar. That is exactly why I'll be using |
Hi Harald @oehhar ! Great seeing you here too. :) Thank you for pointing zint out, I believe I have looked at this in the past. For this to work for us we would need wrappers in Java (pretty simple), Kotlin/Native (should be simple if we could build on the work and plugins developed above - or at least use them for guidance), WASM (I believe this can be done via emscripten). @axxel thanks for the links and info regarding the discussions.
This sounds good to me! From our perspective we would mostly be interested in the generation side, so this leads to the question, where would our efforts best be spent? From the wrapping perspective in Java, Kotlin/Native, WASM building on the zint base would probably make more sense, seeing as the common denominator for the platforms we're interested in is mostly C and not C++. (Of course I'm saying this without having spent any meaningful time in exploring the zint code base.) |
The original zint web-site cites ports to Java and .Net. |
At first, participating in the discussion about requirements would help the most. I summed up the current situation in a new discussion: #739. Let's please move any further conversation regarding this topic over there. If the API and feature-set discussion has concluded, there is a need to 'type that out' in the different wrappers but that should actually not be too much work, once the foundation in the c++-backend is set.
I already have a relatively clear path forward in my mind (see #739). I would hope that your priorities either already align with those stated there and if not, that we can all agree on a suitable way forward. But I will not be interested in merging something like a 'plain wrapper` around the libzint API. I care about consistency and ease of use - and performance, but that is mostly an issue on the reader part of the problem domain. |
And here is finally it is: https://github.com/ISNing/ZXingKMP And I finally find (These differences indeed makes a big trouble binding them to a unified interface, If possible in the future, I hope to switch them all to use jni or sth to call P.S. For me lacking knowledge in this area There are many behavior not aligned between java target and native target P.S.2 Also looking forward to the kn wrapper's publishing |
@ISNing Thanks for sharing this information. I have not looked much into it yet. But I have an issue with the kn build after some cmake changes. Can you make sens of that error message: https://github.com/axxel/zxing-cpp/actions/runs/8180140576/job/22367578496 ? |
@ISNing I'm sorry to inform you that I'm about to make yet another change (that would actually kind of obsolete your most recent fix :-/). My new idea is to add a conditional I don't even know whether that approach is going to end up in zxing-cpp but maybe you'd like to fix your plugin anyway to be able to work with any cmake library using |
Yes, absolutely I'll fix that. |
@Phaestion @ISNing After there has been zero discussion/feedback about the writer API strategy, I went ahead with what I outlined. This is still not final in terms of which properties are exposed but if you are interested in working on the Kotlin/Native part of the creator/writer API, now would indeed be a good time to look into this. I already added the Python and Rust API and would likely look into .NET next. |
Good to hear that! I will look into that and implement the writer api as soon as I have enough free time! |
@ISNing I'm finally about to make the next release, which would be the first that "includes" your wrapper. I took this as a nudge to look into the naming of the API again. The motivation being to keep at least the 3 new wrappers as consistent as the different technologies allow. Since the writer API is still considered experimental, I don't worry too much about that but there is one function ( Would you mind if I renamed this function to See also e.g. the .NET wrapper and the discussion in #724 and especially this comment |
I don't have any research on C#, but I think it's obvious that For ease of use, we can even expand This is only considered from the semantics of the function, and does not consider the difficulty and consistency of the actual implementation, and just a liittle advice |
This adds an `append(BytesArray&&)` overwrite to support the `{data, size}` based call from within `CreateBarcode` function. See also zxing-cpp#719 (comment)
This adds an `append(string_view<uint8>)` overwrite to support the `{data, size}` based call from within `CreateBarcode` function. And removes the use of `using enum`, sigh... See also zxing-cpp#719 (comment)
Uh oh!
There was an error while loading. Please reload this page.