apollographql / apollo-kotlin

:rocket:  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
https://www.apollographql.com/docs/kotlin
MIT License
3.76k stars 654 forks source link

[IJ Plugin] Reconsider use Gradle's continuous mode for automatic codegen #5529

Open BoD opened 10 months ago

BoD commented 10 months ago

Currently the automatic codegen feature works by invoking Gradle in continuous mode. While this was a handy way to implement this without having to replicate the file monitoring handled by Gradle, it has the disadvantage of keeping a daemon running always, in BUSY status (not available for other builds) - which consumes memory on the system.

Consider reverting to manually trigger the codegen task when GQL files are touched.

BoD commented 10 months ago

Even better if we can bypass Gradle completely and invoke the compiler directly. Work in #5516 should help for this!

richardleggett commented 2 months ago

Just came across this issue as we have -Xmx=8g in our gradle.properties and noticed that just launching Studio would spawn this extra daemon before we start IDE sync or builds. So we end up with 2 daemons and we're running out of system RAM in a 660 module KMP project with 15x 5k LoC schemas.

I think it's working as expected - but a way to avoid this staying BUSY (or use a lower Xmx than in gradle.properties) would be amazing.

BoD commented 2 months ago

Thanks for the feedback!

There is no immediate solution to this - maybe a temporary improvement would be to pass a dedicated -Xmx but then a question is what's a good value for it.

At least in the meantime you can disable the automatic codegen and still benefit from the plugin's other features (Settings | Languages & Frameworks | GraphQL | Apollo Kotlin | Automatic Code Generation)