Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle.daemon always overwritten on gradle.properties #982

Closed
fserb opened this issue May 31, 2020 · 4 comments · Fixed by #1276
Closed

gradle.daemon always overwritten on gradle.properties #982

fserb opened this issue May 31, 2020 · 4 comments · Fixed by #1276

Comments

@fserb
Copy link
Contributor

fserb commented May 31, 2020

One can't disable gradle daemon by any method at this point using cordova android.
gradle.properties has org.gradle.daemon=true and it gets overwritten every time you run cordova build android.

There should be an easy way to do this. Right now, people are forced to use the demon (even for a one-off build) and do a ./gradlew -stop to prevent the daemon from staying forever running. This is weird.

@breautek
Copy link
Contributor

breautek commented Jun 1, 2020

If you really want to kill the gradle daemon after each build, an easy way to do this would be to add the following in your package.json file:

...
{
  "scripts": {
    "build-android": "cordova build android && gradle --stop"
  }
}

Then you can build using: npm run build-android

But you needn’t worry about a build up of Gradle processes on your machine, though. Every Daemon monitors its memory usage compared to total system memory and will stop itself if idle when available system memory is low. According to Gradle Documentation.

May I ask why you would like to disable the Gradle daemon?

@fserb
Copy link
Contributor Author

fserb commented Jun 1, 2020

Yeah, that's close to what I did in the end. I created an after_build hook on android that kills gradle.

That's the whole point of this. You should not have to ask me why. There's an option on gradle, the option should be respected and not overwritten every time it's run. Specially if it's an option that leave a daemon running on my computer, that should not even be default. This setting should be in the documentation, not in the default.

Running cordova android doesn't give it permission to do whatever it wants on the computer. It definitely doesn't state that "this is a cordova android development machine, which is what I'll be doing until I reboot, so please spawn daemons to make this faster next time".

This is a horrible practice. Not only everything would be worse off if every program acted like this, but also, it's a huge break of trust between a command line application and the user. This is borderline malware level of evilness.

@erisu
Copy link
Member

erisu commented Jun 1, 2020

If you think daemon should not be default. Then you should probably go take that up with Gradle and not with us.

The Gradle Daemon is enabled by default starting with Gradle 3.0, so you don't have to do anything to benefit from it.

Quoted from Gradle documentation.

As for the issue where your setting keeps getting overwritten with our default is an issue that is something we can look into and fix when we get to it. That is a bug.

But we are not going to change our default.

@fserb
Copy link
Contributor Author

fserb commented Jun 1, 2020

if it's a default on gradle, then it doesn't need to be a forced one on cordova-android, right? So we can just remove that line completely and it should just do the awful thing by default. But then at least I can manually change the configuration to prevent it from happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants