Progressing a lot on my Compose Desktop Native usi...
# feed
s
Progressing a lot on my Compose Desktop Native using SDL. Most of it is now just vendored via a sync script. Right now I just finished making viewmodel and navigation3 work properly github.com/bitsycore/ComposeDesktopNative For now there is :
Copy code
compose/
├── ui/    <--- full, but some module merged for now until renderer actual are more modularized
│   ├── ui/
│   ├── ui-util/
│   ├── ui-geometry/
│   ├── ui-unit/
│   └── ui-backhandler/
├── animation/ <--- full
│   ├── animation-core/
│   ├── animation/
│   └── animation-graphics/
├── foundation/ <--- full
│   ├── foundation/
│   └── foundation-layout/
├── material3/material3/
├── material/material-ripple/
└── sdl/
    ├── window/   <----- SDL main loop
    └── material-symbols/  <--- Automated material symbols packer and minimifier
navigation3/
└── navigation3-ui/


Dependency working from upstream:
    org.jetbrains.compose.runtime:runtime(-saveable)
    androidx.lifecycle:lifecycle-viewmodel(-compose, -savedstate, -navigation3)
    androidx.savedstate:savedstate(-compose)
    androidx.navigation3:navigation3-runtime
    androidx.navigationevent:navigationevent-compose
    androidx.collection:collection
💯 5
K 9
🚀 5
a
oh man I love this! definitely going to give this a try. I've got a pretty large CMP project that I dream of dropping the JVM for
a
Looks awesome 👍
s
I asked about really going native with Compose at KotlinConf 23 closing panel, but the answer back then was just "go with GraalVM", which wasn't really what I wanted.
😢 1
s
Graal VM don't work for macos desktop :/
s
For macOS Desktop they have something experimental in their repo, but not for Windows at all.
s
Yeah there is but I don't use it to rely on common SDL lib for crossplatform
Allowing me to write code multiplatform just in nativeMain
Right now I have my demo project running with dependency set in nativeMain and in desktopMain and comonization work allowing to have common ui working fully
a
man that's a bummer to hear @Stefan Oltmann I was really hoping their plan was to support K/N generally, especially with their windowing project: https://github.com/JetBrains/kotlin-desktop-toolkit
👀 1
👍 1
s
@Adam Brown Thanks for the hint to that project. I asked 3 years ago and got that answer. This project started last year. So maybe they changed their mind. 🙂
🤩 1
s
Look like it's only jvm
🤔 1
s
Look like it's only jvm
Why do you think that? This looks all pretty native to me. github.com/JetBrains/…/win32
s
@Stefan Oltmann It use java stuff in the source files and doesn't use kotlin multiplatform
It seem to just make a common jvm api to replace awt
Swing etc..
a
Its uses native, look wayland, win32
☝️ 1
what it is not using is compose
probably they plan to add but as they state they not plan to suport mobile cause its different
so that means they will use something else for their controls toolkit, something other than google material3
could be still compose but otherwidgets
that makes sense cause i dont want mobile widgets in an ide
for some apps its okay
for an ide not really
ah no my bad, they just abstract the desktop windowing
like u use SDL for this they use the native windows, then render inside that window with skiko/skia
s
Yeah
a
as far as i see
s
They prob want to drop annoying swing/awt and will help for graalvm
I'm trying to get the real composeResource to work right now to help comonnisation
a
i might guess that swing/awt would still be there for the jvm target, cause ther the jvm does the bindings through awt
s
This replace swing/awt on the jvm
You don't need it to open a window anymore
a
i mean you would compile to native and would bypass the jvm its a different sourse set, targeting specific platforms, so it goes around the swing/awt sort to say it
but you would still have the swing/awt option if you want
s
Compose Desktop already have different platform because skia binary is platform dependend
it is still called from jvm sourceset but with a expect for this api to the different platform
a
yeah so now skia is called by the jvm as i understand
and all that file dialogs and os stuff is called through jvm
s
that's the same here except the call end to a binary for doing the os call instead of directly using the awt layer
s
Can you link to the source where it's using the JVM?
a
now i see kmp libraries which call into native do the conection to native through jvm/jni, would be nice to see this additional layer droped, but i imagine there would a lot of work bringing all platforms to the same api, jvm does this already good for many years
a
yeah looks like it still goes through jvm at the moment :)
but its on a good trajectory
s
Just use SDL bruh 😁😁
a
i will definitely try it at some point, looks like less dancing around compared to jni
one question though like how much work would be needed when the compose version changes, and if i include this, i would do as a separate library with transient dep on the jetbrains compose?
s
I'm struggling to build a new artifact that use original compose multiplatform with extra target without recompiling evertything, I tried to add stub for it and redirect but for now no success
It compile but ide is full red 😞
a
so you are aiming for transient dep
?
s
I don't really need it but having it fully compose multiplatform compatible must be possible and not far from current state
a
just was wondering if compose updates do you need to play catchp with it
sometimes a small feature needed, requires an update of a dep, and that dep triggers an avalanche of other deps updates, sometimes it happens
s
there is a script for pinning the version you want and vendor all the files you need while listing them, allowing to do either instant upgrade (if no new actual)
so you can stay up to date easly
right now it's
Copy code
# Tag at this commit: v1.12.0-beta01+dev4324
1be9d64ad12db0c79f44aedf9d9388e644c60871
demo-win64.zip,apidemo-win64.zip
a
on mobile now, otherwise on linux )
s
wine and it's fully static linked so should work
a
ill give a try tomorrow mby
s
github.com/bitsycore/…/v0.1.11 The maven packages are available on github now based on compose v1.12.0-beta01 and SDL 3.4.12 With also Material3 and Navigation3. apidemo and demo are also available on each platform This is still rought and experimental
🔥 1
So I continued to do some fix, enchancing and also came up with a gralde plugin allowing to easly setup the project. Here is a multiplatform (jvm desktop, android and compose desktop native) project doing the minimal setup github.com/bitsycore/compose-desktop-native-bridge-example The plugin allow redirection to proper artifact when targeting native, allow to set entry point and bundle ressources like compose ressources.
🤩 2