I would like to setup a global gradle build dir that points to a ramdisk.
I've tried numerous ways of setting up the build dir in my global gradle.properties
file located at ~/.gradle/gradle.properties
.
The issue I'm facing is that gradle does not evaluate the variables/relative-expressions that are included in the buildDir
config.
How do I setup a global build dir that takes care of project specific subfolders?
gradle.projectsLoaded {
rootProject.allprojects {
buildDir=~/.gradle/build/${rootProject.name}/${project.name}
}
}
OK, I've figured it out. The main reason for my issues where that I've assumed that the gradle.properties
files also executes included scripting expressions (i.e., the included variables and string formatting).
This is not the case!
So, to solve this issue I came up with the following init.gradle
file (~/.gradle/init.gradle
):
allprojects {
buildDir="$System.env.HOME/.gradle/build/${it.name}/"
}