Is it bad practice for a plugin to write to GRADLE_USER_HOME?


I’m writing a Gradle plugin that keeps a log of how long each build takes and is able to generate a report about how the build duration has changed over time:

I’m not sure what the best location is to keep that logfile in. Requirements are: It should not land in the user’s VCS and it should not be cleaned away. Options I’ve come up with:

  • Put it in the buildDir

Probably the cleanest solution, but it could be accidentally cleaned away.

  • Leave it somewhere in the project

Additional work for the user as it has to be kept in the VCS ignores, also, it could be lost accidentally, e.g. when the user switches branches around.

  • Write it to GRADLE_USER_HOME/godot/$projectName.log

Would solve the problems above, but it’s a bit hidden away and littering a hidden directory with logs also isn’t the nicest behavior.

What would be the canonical location for something like this logfile?

The way we do it for some of our custom reports (e.g., performance between Gradle releases) is to write it to build/reports and let the CI server archive reports between builds.

I’d probably say default to the build area (build/reports/godot/*) and have a property someone could put in their if they wanted to put the reports somewhere else.

thanks, that’s how I did it now!