kotlinx-rpc icon indicating copy to clipboard operation
kotlinx-rpc copied to clipboard

Add support for Wasm

Open SalomonBrys opened this issue 1 year ago • 6 comments
trafficstars

Please deploy artifact for the wasmJs & wasmWasi targets.

SalomonBrys avatar Jun 11 '24 15:06 SalomonBrys

I would love that too if it is possible. RIght now on compose multiplatform I use Canvas on JS target to make my UI just because of no wasJs target :/

ShayOinif avatar Jun 13 '24 16:06 ShayOinif

Even if it is just annotations, so we can annotate classes in commonMain with wasm targets

sgammon avatar Jul 11 '24 07:07 sgammon

@sgammon can you please elaborate on your comment? What annotations are you talking about?

Mr3zee avatar Jul 15 '24 09:07 Mr3zee

@Mr3zee Sorry, I mean annotations or interfaces. Things that can safely be included in a common target, so that we can at least create our RPC interfaces in a common target, even if we can't implement them there yet.

sgammon avatar Jul 16 '24 00:07 sgammon

I see, thank you I'll if this is worth to do now, or it would be easier just to support WASM fully

Mr3zee avatar Jul 16 '24 09:07 Mr3zee

@Mr3zee when can we plan with wasm support?

lian-hsc avatar Aug 13 '24 12:08 lian-hsc

If I understand correctly, this feature will be delivered in the next version of kotlinx-rpc. Do you have any idea when ?

sylvain-barrepersyn avatar Sep 03 '24 08:09 sylvain-barrepersyn

No ETA for now

Mr3zee avatar Sep 03 '24 12:09 Mr3zee

@Mr3zee Could a WASM target be added which is functionally empty? Or even just has kotlinx.rpc.RPC defined as an interface? That would be sufficient for our needs for now.

Because KotlinX RPC does not ship a WASM target, we cannot use KotlinX RPC in any source set which ships for WASM, or which ultimately is depended on downstream by a source set for WASM, whether or not those source sets make use of RPC.

sgammon avatar Sep 03 '24 17:09 sgammon

I would humbly ask that you reconsider because KotlinX RPC is the only KotlinX library we cannot use due to this reason

sgammon avatar Sep 03 '24 17:09 sgammon

I very agree, just to compile projet and permit to have a shared module (multiplatform one) in projects which have the goal to target WASM in the future. It can be useful to juste have an empty dependency compliant to this target.

sylvain-barrepersyn avatar Sep 04 '24 16:09 sylvain-barrepersyn

WASI is blocked by https://github.com/oshai/kotlin-logging/issues/433, wasmJs is WIP

Mr3zee avatar Sep 09 '24 14:09 Mr3zee

I would actually be surprised to find oshai/kotlin-logging as a dependency to RPC...

sgammon avatar Sep 10 '24 18:09 sgammon

@sgammon It is a dependency for the kRPC protocol implementation For core declarations both WASMs will be added right away

Necessity for the logging dependency will be assessed before going stable

Mr3zee avatar Sep 10 '24 18:09 Mr3zee

@Mr3zee Am I correct in my assumption that this is the only place a KotlinX library depends on something outside of kotlin-stdlib and other KotlinX libraries?

sgammon avatar Sep 11 '24 00:09 sgammon

@sgammon technically, yes (though I'm not sure about all of the other kotlinx libs).

But there is a little more to that. Our core module depends only on atomicfu, coroutines and serialization. Core module and codegen plugins make the foundation of the library, so being dependent on core libs is only logical.

Then kRPC (and other modules in work) is an implementation of the library foundation, more complex than core itself, and requires external dependencies. And while logging is a debatable topic here, and it may happen, that kRPC will also be dependent only on core libs, for gRPC, for example, it surely will not be the case, as we will use existing platform specific libs to provide this integration. Implementing gRPC protocol from scratch is not what we want to do.

Mr3zee avatar Sep 11 '24 07:09 Mr3zee

@Mr3zee Thank you so much for shipping this one!

sgammon avatar Sep 24 '24 03:09 sgammon

Looks like wasi is supported in kotlin-logging by https://github.com/oshai/kotlin-logging/pull/551

lukewarlow avatar Sep 01 '25 19:09 lukewarlow