JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.42k stars 1.12k forks source link

Experimental example application without AWT implementation #2825

Open igordmn opened 1 year ago

igordmn commented 1 year ago

Desktop target of Compose Multiplatform uses AWT/Swing under the hood. It adds many advantages, but also adds many issues.

Investigate:

We can:

  1. Write a sample application with not simple UI on stable Compose Multiplatform
  2. Try to gradually get rid of AWT dependencies in Compose/Skiko. Just leave stubs at the moment. We are only investigating.
  3. Implement support for GraalVM
  4. [optional] Implement support for Kotlin Native (we already have some prototypes for macOS)
  5. Compare all implementations in terms of performance (RAM, the startup time, FPS)
  6. Make a list of features that we need to reimplement when we get rid of AWT.

Note, that AWT/Swing implementation will still be needed for Swing interop (needed for IDEA interop).

P.S. We have one very simple example without AWT here: https://github.com/JetBrains/compose-jb/tree/master/experimental/lwjgl-integration

sureshg commented 1 year ago

Thought of sharing this here as compose-jb team is exploring the AOT compilation. Dynamic linking of AWT libraries are now available on Windows and Linux GraalVM native images (changes are merged last week) - https://github.com/oracle/graal/commit/f375678d6aefc7b9009aa9a01a6dfdb5fed12f7e . I think they are now working on the mac os support and is tracked as part of this issue - https://github.com/oracle/graal/issues/4921

mipastgt commented 1 year ago

It would be interesting to see whether this issue https://github.com/JetBrains/skiko/issues/580 which I originaly reported to bellsoft https://github.com/bell-sw/LibericaNIK/issues/14 here will be fixed by these changes once they land on the mac.

wakaztahir commented 10 months ago

Any updates ? I'd really prefer Kotlin Native since that'll bring direct native support and sometimes just interacting with OS gets hard in JVM, e.g opening a folder selection dialog

dima-avdeev-jb commented 9 months ago

Any updates ?

It is very interesting experimental research. But, for now we are pausing it. Because we want to provide another features and bug fixes. I hope we will continue it later! Stay tunned!

jershell commented 5 months ago

When it will to continue i think we can check skiko+(GLFW or SDL) as backend for support native target. some points

Laxystem commented 5 months ago

Is Kotlin/WASI support also planned/experimented with?

dima-avdeev-jb commented 5 months ago

@Laxystem Do you mean Compose with Wasm? Yes, Compose Wasm is experimental now. Here we have one very early experimental example: https://github.com/Kotlin/kotlin-wasm-examples/tree/main/compose-imageviewer#compose-multiplatform-for-web Latter we will migrate all our examples to WASM too

Laxystem commented 5 months ago

@Laxystem Do you mean Compose with Wasm? Yes, Compose Wasm is experimental now. Here we have one very early experimental example: https://github.com/Kotlin/kotlin-wasm-examples/tree/main/compose-imageviewer#compose-multiplatform-for-web Latter we will migrate all our examples to WASM too

I mean, Kotlin supports two Wasm targets, Kotlin/WasmJS (for the web) and Kotlin/WasmWASI (for everything else, via the WASI libraries).

Afaik Compose/Wasm only compiles to Kotlin/WasmJS. Is compose also experimenting with supporting Kotlin/WasmWASI?

jershell commented 5 months ago

@Laxystem Do you mean Compose with Wasm? Yes, Compose Wasm is experimental now. Here we have one very early experimental example: https://github.com/Kotlin/kotlin-wasm-examples/tree/main/compose-imageviewer#compose-multiplatform-for-web Latter we will migrate all our examples to WASM too

I mean, Kotlin supports two Wasm targets, Kotlin/WasmJS (for the web) and Kotlin/WasmWASI (for everything else, via the WASI libraries).

Afaik Compose/Wasm only compiles to Kotlin/WasmJS. Is compose also experimenting with supporting Kotlin/WasmWASI?

I think at the moment there is no way to get the user interface of the application. This is not part of wasi. Depending on the difference in the runtime implementation, it may work with the imported functions.

https://github.com/WebAssembly/WASI/issues/53