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

Explore Kotlin/Wasm support using WASI #245

Closed
sdeleuze opened this issue Jan 15, 2023 · 4 comments
Closed

Explore Kotlin/Wasm support using WASI #245

sdeleuze opened this issue Jan 15, 2023 · 4 comments

Comments

@sdeleuze
Copy link

This is obviously still the early days of Kotlin/Wasm which is not yet really usable, but be aware I would like to begin exploring Kotlin/Wasm support using WASI. I am initially experimenting on https://github.com/sdeleuze/kowasm/ side (see kowasm/kowasm#9 related issue) and then later would like to contribute a PR here when Kotlin/Wasm will be more mature and WASI supported out of the box (may take some time).

Any thoughts from your team on a potential future WASI support? Is there anything preventing me creating an experimental Kotlin/Wasm + WASI support in an external repository?

@dkhalanskyjb
Copy link
Collaborator

https://github.com/Kotlin/kotlinx-datetime/tree/0f4c62d32d87b35d8af54b408ed8685d0ddfd18a/core/native/src this (in combination with https://github.com/Kotlin/kotlinx-datetime/tree/0f4c62d32d87b35d8af54b408ed8685d0ddfd18a/core/common) contains the pure Kotlin implementation of everything in kotlinx-datetime, except for the things listed here: https://github.com/Kotlin/kotlinx-datetime/blob/0f4c62d32d87b35d8af54b408ed8685d0ddfd18a/core/native/cinterop/public/cdate.h They have to be provided by the platform. If you can implement all the declarations listed there, nothing prevents you from having a WASI target.

@sdeleuze
Copy link
Author

sdeleuze commented Jan 21, 2023

I initially tried to fork the repository, updating it to use Kotlin 1.8.20 dev build, but the lack of Kotlinx.serialization support + other issues related to the fact that core/native/src is currently designed for native (probably solvable via a refined hierarchical project structure) made it too difficult.

So for now via this commit I just copied core/native/src and core/common, implemented currentTime() with WASI, and provided an implementation of RegionTimeZone that throws UnsupportedOperationException, and it seems to work pretty fine expect for timezones.

Edit : now available in a dedicated module

@sdeleuze
Copy link
Author

sdeleuze commented Mar 6, 2023

Timezone support should be available as of WASI Preview2, see WebAssembly/wasi-clocks#25 related issue.

@dkhalanskyjb
Copy link
Collaborator

Closing in favor of the more general #324

@dkhalanskyjb dkhalanskyjb closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
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

3 participants
@sdeleuze @dkhalanskyjb and others