How can I compile the compose library and load the...
# compose-desktop
x
How can I compile the compose library and load the local version in my project? I cloned the repo and I think I built the library using
./gradlew :compose:assemble
I have no idea where to from this though and I did spend a whole trying to make it work. Should I post this in #androidx instead as it's library stuff?
b
Try adding it as gradle included build and see if it resolves
x
Thanks for the reply, I'll be honest I'm a noob to this and especially so with the Kotlin DSL that the desktop compose project generated, it's completely different from what I get on an Android project. How would I that?
e
x
Oh wow! Thanks a lot, that's exactly what I was looking for.
I imagine it'd be super useful to set up a local maven repo right?
k
https://github.com/JetBrains/androidx is where the multiplatform version of Compose lives. There’s a lot of branches in there. Looks like 1.3.0 is getting almost ready at https://github.com/JetBrains/compose-jb/tree/release/1.3.0
As for a local repo, the question is what do you need. Are you planning to do local changes to the Compose sources? Are you in a situation without network connectivity and you want all your dependencies available locally? Something else that would need a local copy of Compose?
x
Aha! So I should clone this, and not from the one from Google?
I want to create a text editor widget
k
OK, you don’t need a local repo for that
x
Need multi-cursor support and some other features that I think would be cleaner to modify the library
What do you recommend I do instead?
I need to modify some internals I think, and I need to have a delegate that handles the multi cursors and a shared edit buffer
k
Step back for a second. Do you know that you need to modify Compose sources, or you think you might need to? These are two different things. And if you are modifying Compose sources, you need a plan to get them upstreamed so that your library / widget is useful outside of your local environment.
x
I don't have to but if I don't the solution is pretty hacky although very simple. But I'd like to try what a tailor made solution would look like. Hmm, is there a use for this in upstream?
k
That’s impossible to answer until you show the usefullness of the code to the project owners
x
I will be using a ropes data structure internally and this would allow for rich text editing with large files but I wonder how much of those features would be considered bloat
Or maybe I should decouple the ropes structure from the internal and pass strings to the internals, I have no idea what is better but I'd like to test things out first and get familiar with building the library and modifying it first which will take me a few days for sure
k
Back to your original question, I haven’t tried local deployment with Compose, but for Skiko it was pretty easy.
./gradlew :skiko:publishToMavenLocal
was the only thing to run, and then update your sample module to local at local maven first and use
0.0.0-SNAPSHOT
as the version. Might be different for Compose though
Ah, the instructions for Compose are at the link that Eliezer posted earlier
x
Yup, thanks a lot both of you, this is amazing! And to think that I didn't even clone the correct repo to begin with lol
k
And to the second part. If there are things that “need” to exist in the upstream Compose (common for all platforms, or only desktop) that would enable a rich text editor widget, that’s certainly something that would be worth pushing for. That’s what I did when I contributed a few patches to Skiko to enable shader based render effects. Smaller contributions are usually easier to get in, as project owners / maintainers need to think about long term support for any such contribution, and how it plays with other parts of the project - today and in the future.
My own personal preference is also to communicate such information ahead of time - in the project bug tracker - to get a feel of what the project owners think about it. You probably wouldn’t want to spend months of your time working on something that has no chance of being included upstream.
x
If anything I really need the experience as this is completely new territory to me and the project I'm doing this for has no real time limit as it's a long term personal project of mine. Even if I fail to get anything to work this will at the very least be a great opportunity to learn. Upstream quality code would be great but that was not my original intention, and wouldn't be able to do that without rewriting anyways since I am jumping head first into the library. You mentioned Skiko, what are the things you can do with it that you can't do with Composables? I wonder if Skiko (I'm assuming I can use it together with compose) would be an easier solution to my problem?
k
Skiko is low level bindings to Skia, which is the rendering engine that puts pixels on the screen
x
I see, if I were to guess I'd say it wouldn't help much as from the initial look the classes of interest to me are probably
TextPainter
,
TextInputService
,
TextFieldValue
, and
EditProcessor
Now I am stuck fighting the build system or whatever is preventing the LSP from working 🙁 How can I get the LSP to work with the compose-jb source? It doesn't work in android studio or emacs with
fwcd/kotlin-language-server
.
kotlin-language-server
displays a lot of messages of things being compiled with kotlin 1.8.0, messages look something like
'kotlin.Unit' was compiled with an incompatible version...
as for android studio here's a screenshot:
k
The project uses the internal APIs of the Kotlin compiler.
- looks like the project author isn’t keeping it up to date with the changes that are going into Kotlin
x
I should add that I am completely new to gradle and large projects' build systems in general so I might be missing something obvious
k
Why are you bringing in the language server into the mix?
x
I will try to make this work with android studio if not ig no LSP for this one, for now. The reason I was trying to set-up emacs is due to hardware limitations although I can just about get away with android studio
Oh, when I say LSP I mean with emacs and not with android studio, but I kind of want intellisense to work on studio otherwise what's the point of using it lol
but I can't either to work
k
Nothing to do with compose-jb or this channel then
x
It's just with compose-jb that it doesn't work that's why I asked here. Normal compose projects and android apps work fine.
Where should I ask for help instead?
k
There’s #emacs which isn’t super active. Maybe #getting-started to get a bit more exposure. Provide some details on the setup, what works and what doesn’t. Don’t just drop people in the middle of it.