Gradle syncing is so painful in multiplatform, it'...
# multiplatform
m
Gradle syncing is so painful in multiplatform, it's taking too much time and hanging most of the time (I'm using the latest version of everything but still...) and can't understand why canceling tasks also causes hanging in intellij. I hope that Amper can fix this.
l
I'm not sure it's multiplatform's fault. This is an issue with Gradle.
m
Not sure tbh, but gradle is working fine with android or jvm. I'm not trying to blame anyone, I know that the team is doing great work. But I'm just trying to give more importance to this issue because it's bad for the dev experience and productivity.
l
I have no problems laying blame on Gradle, I'm very much not a fan.
1
😂 5
3
The problem is that Gradle requires you to evaluate arbitrary code when loading the project, so if that code does bad things (as in: things that the IDE does not expect) you're going to have trouble.
That's why I never see your issues in my somewhat large multiplatform project, while you do. And I'm pretty sure it's not your fault, even though you could likely fix it my making some obscure change in your gradle scripts. A good build tool should not allow that to happen.
m
Well, as I said, I hope that Amper fixes this 😆
If you have any tips to avoid this kind of issues, let me know
l
Is it an open source project? I'll be happy to look at your gradle files to see if I see something obvious.
My open source project is multiplatform with 7 modules or so.
m
Yes, feel free to check it: https://github.com/MohamedRejeb/Calf I have some shared Gradle configuration using extension functions here (which is something I like with gradle xD)
l
Your code looks a lot cleaner than mine. To be honest, I'd much more expect my monster configurations to fail before yours do.
😄 2
m
It's working fine. The issue is happening from time to time and mostly requires restarting IntelliJ and it's not related to that particular project. It's something that I experience very often when I sync projects with +10 modules
l
I have 17
build.gradle
files in my project.
Just as a point of reference
How often does it happen? I can load your project and try restarting a few times.
m
There's some special cases, when you first update IntelliJ or if the laptop and intellij wasn't closes for so long (days...)
So the hanging is not happening very often, but even when everything is working fine, syncing projects is slow. Especially when I work with a team, I need to sync a lot (switch between branches, merging code that has some updates or config changes...)
l
I'm importing your project now.
How long does the import usually take?
I got a warning saying "duplicate content roots".
a
Your build logic looks good! It's strange that it's slow. I suggest trying to enable Configuration Cache. It should help with the import speed, and in general (it allows running tasks in the same project to run in parallel, if possible). Sometimes CC causes strange issues, so you might have to fix them.
I'd also suggest updating the convention plugins to use pre-compiled script plugins. I think it's better to avoid dynamically applying plugins and instead use the
plugins {}
block. E.g. avoid doing
apply(plugin = "...")
https://github.com/MohamedRejeb/Calf/blob/c6c586c780ae8183b55ad4f8db7574c347f3ccbc/convention-plugins/src/main/kotlin/Publication.kt#L34-L35
thank you color 1
l
Aside from build problems, this looks like a neat project.
thank you color 1
m
Thanks, I will try to get rid of
apply(plugin = "...")
and improve the convention plugins
h
BTW as long as Amper itself uses Gradle under the hood, you won’t notice a difference 😜
1