Kill the gradle daemon?


I just noticed that something was tapping out both my CPU & RAM pretty hard. I ran top to see what it was and it turns out that gradle is launching into daemon mode, and playing pacman with my system resources for no good reason.

Did some digging and realized that for some reason ionic (or something it depends on), is actually passing a build flag in that basically tells gradle “Hey, despite the fact that you’re a massive resource hog, please feel free to chill out in daemon mode and chow down on the system resources! That way the user can wait a solid 5 seconds in between key presses, but hey no worries, we might shave 30 seconds on build times!”

I tried to change the setting in ~/.gradle/ but of course it’s being ignored since the flag is being passed in on the command line higher up in the build process.

What the heck is setting -Dorg.gradle.daemon=true and more importantly how do I make it stop?

This daemon is no joke, it’s happily chewing up 10% of my CPU and 60% of my RAM, just sitting there doing absolutely nothing useful for me.

Doing a ps to get the process id and then killing it with kill -s SIGTERM is making both my computer and the build process (when I relaunch a build) run much faster, but that’s a heck of a kludge for something that shouldn’t be on by default in the first place.



Turns out grep was a good friend on this.
The line is located in platforms/android/cordova/lib/build.js
Specifically line 242 and in the gradle: section of the build file.
Found this part hilarious…
// 10 seconds -> 6 seconds
// Shaves another 100ms, but produces a “try at own risk” warning. Not worth it (yet):

Read this to understand…

Seriously, don’t rice your build files guys. Add it as an option if it really makes you happy, but don’t go sticking performance junk in as mandatory.