Skip to content
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 JS / multi-platform support #1007

Closed
wadejensen opened this issue Sep 2, 2018 · 27 comments
Closed

Kotlin JS / multi-platform support #1007

wadejensen opened this issue Sep 2, 2018 · 27 comments

Comments

@wadejensen
Copy link

I went to use Arrow for a frontend application transpiled from Kotlin to JavaScript and realised that it Arrow doesn't support the JS platform due to explicit Java dependencies.
It would be awesome to see Arrow migrate to being a multiplatform library.

@raulraja
Copy link
Member

raulraja commented Sep 2, 2018

@wadejensen I think this is everyone's desire as well but nobody currently pushing the lib has that use case. If you want to give it a shot the first thing we have to do is compile a shopping list of what needs to change currently in the code base to support Kotlin JS/Native and we can take it from there recommending approaches to tackle each one of the parts.

@wadejensen
Copy link
Author

Thanks for the response @raulraja. My use case is very casual at the moment, so I don't have bandwidth to dedicate to this, but if that changes I will give it a red hot go.

@pakoito
Copy link
Member

pakoito commented Sep 3, 2018

@AregevDev took a look for the Native port, and we're currently blocked on kapt and KindedJ. There's also a concurrent map in some memoization function, but that's fixable.

@raulraja
Copy link
Member

raulraja commented Sep 3, 2018

@pakoito so no kapt on js and native?

@pakoito
Copy link
Member

pakoito commented Sep 3, 2018

No, and no plans for it either.

@AregevDev
Copy link

AregevDev commented Sep 4, 2018

Maybe try to generate the code and then call the compiler to include the generated classes?

@AregevDev
Copy link

AregevDev commented Sep 4, 2018

They are only generating a class and two typealiass...

@janvladimirmostert
Copy link

what is kapt used for, only for the @optic annotations ?

@pakoito
Copy link
Member

pakoito commented Mar 13, 2019

@higherkind is the blocker for arrow-core, @extends for arrow-typeclasses

@JorgeCastilloPrz
Copy link
Member

I also assume kapt (specifically annotation processors) will not be a thing for JavaScript either. We'd probably need to look for alternatives on code derivation for both platforms that can have a common API but implemented differently.

@1Jajen1
Copy link
Member

1Jajen1 commented Mar 13, 2019

How do projects like kotlinx.serialization etc work? Are they providing their own compiler plugin? Maybe that is a way to go, may be a lot of work tho.

@viluon
Copy link

viluon commented Jul 23, 2019

Regarding compiler plugins, this is a valuable resource.

@MattX
Copy link

MattX commented Mar 20, 2020

(I don't know much about JVM annotation processors, so maybe this is very dumb)

My understanding is that Kapt, like other annotation processors, will generate extra .kt files, which are then included in the regular compilation process. Would it be possible to run Kapt in a JVM environment to generate these files, and then compile everything with the Kotlin/JS compiler? I'm curious to know why not if not.

@mkotsbak
Copy link

Maybe https://github.com/Foso/MpApt could be used instead of kapt? It supports multiplatform.

@kierans
Copy link

kierans commented Jun 2, 2021

My use case is that I'm writing a library that I want to be able to use on iOS as well as JVM targets (including Android). It would be super awesome if Arrow could do this.

@nomisRev
Copy link
Member

nomisRev commented Jun 2, 2021

Hey @kierans, (and everyone following this thread)
These efforts are currently in progress. You can follow the progress in the PRs.

Here is a link to the PR working on JS support (almost finished for Arrow Core), Native is up next :) #2409
Native for Arrow Fx Coroutines might be a little delayed compared to other libraries, since the underlying library KotlinX Coroutines support for native is still experimental and not officially released under the stable releases AFAIK.

As soon as this is merged you can try it on th SNAPSHOT release, the first MILESTONE for Arrow 1.0.0 is expected this summer.

@kierans
Copy link

kierans commented Jul 30, 2021

@raulraja Can you say why you closed this please? It seems a bit arbitrary.

@viluon
Copy link

viluon commented Jul 30, 2021

I see that #2409 got merged, but I'd say proper support also requires documentation on setting up a multiplatform project with Arrow (and perhaps which Arrow libraries work with JS and which ones don't).

@raulraja
Copy link
Member

@kierans @viluon Arrow is now MPP in main, and all tests are passing. The site also is being published next week with instructions to include Arrow MPP in any project as soon as we can add the native tests, which we are waiting for support for Kotest. I closed this because the work is done but reopening now until it's all available to the public.

@raulraja raulraja reopened this Jul 30, 2021
@kierans
Copy link

kierans commented Jul 31, 2021

Thanks for the update @raulraja.

@nomisRev
Copy link
Member

nomisRev commented Aug 1, 2021

For those wanting to try Arrow on JS.
https://github.com/arrow-kt/Arrow-JS-Template

@nomisRev
Copy link
Member

This ticket can finally be closed 🥳 Arrow 1.0 comes with JS support!
If you have any feedback be sure to create an issue here, or chat in #arrow on Kotlin Slack.

@kierans
Copy link

kierans commented Sep 20, 2021

@nomisRev Given this ticket was also about "multi platform support", does this also mean that Arrow 1.0 can be used in native code eg: iOS?

@pakoito
Copy link
Member

pakoito commented Sep 21, 2021

@nomisRev Given this ticket was also about "multi platform support", does this also mean that Arrow 1.0 can be used in native code eg: iOS?

Yes!!

@mysticfall
Copy link

I believe we still lack compiler support for Optics on non-JVM platforms? If so, is there an ongoing effort or existing issue about it?

If there's none, I'd like to open a feature request so that I could keep track of updates.

@nomisRev
Copy link
Member

Hey @mysticfall,

This is already in progress on the Arrow Meta repo, and we're currently testing it before releasing it. There is a ticket here, arrow-kt/arrow-meta#771.

@mysticfall
Copy link

@nomisRev Thanks much for the info! I'll subscribe to the issue then. Can't wait to test it myself :)

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

No branches or pull requests