If I wanted to compile Kotlin code in Compose Multiplatform, how should I approach it? I don't want to embed
kotlin-compiler-embeddable
as its size is very high for a mobile app to support
c
Chrimaeon
08/02/2025, 1:46 PM
Sounds like an XY-Problem. What do you want to achieve and why would you like to compile Kotlin code yourself?
s
skominas.ainis
08/02/2025, 2:47 PM
It isn't XY problem, as I am creating an app where I want the user to have the power to edit small parts of code and compile it themselves. I have JS support in the app, since running WebView is easy and compiling there is easy.
Now I'd like to add Kotlin support. I was thinking I could create a BE where I could compile it, but maybe there are some other ways to do it
c
Chrimaeon
08/02/2025, 2:52 PM
I think you‘ll have problems on iOS with Apples guidelines if you do it in the device.
Also I don’t think there is an Kotlin compiler for iOS.
s
skominas.ainis
08/02/2025, 3:28 PM
Gotcha. Thanks
c
Casey Brooks
08/02/2025, 9:57 PM
You probably won't be able to run the compiler directly inside an app, since it depends on a proper JDK and a whole bunch of other stuff. Instead you might look into using a remote server to do the actual compilation and execute the code. Here's the one that powers https://play.kotlinlang.orghttps://github.com/JetBrains/kotlin-playground
❤️ 1
s
skominas.ainis
08/03/2025, 5:32 AM
Much appreciated! I’ll use this then.
I have Monaco editor (VSCode) embedded to a webview, but to support Kotlin I think I’ll
need to have two separate editors.
My main goal is to support JS and Kotlin for now:)
Thanks again~