make plugin to auto-allocate available RAM to gradle

Gradle inherits Java's weird memory management, meaning it can run out of RAM even though the machine has plenty available. The buildserver instance could use a Gradle plugin to automatically set the limit based on the actual available RAM. Right now, we have do that in metadata hacks: fdroiddata!9770 (merged)