Reputation: 17788
I can set the build directory manually like following for example:
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
}
This can be done in my project's build.gradle
. I want to change this directory on one computer only, so I want to somehow define this globally like I for example define credentials in the Global Properties gradle.properties
file.
Can I somehow define the buildDir
globally on one machine? I want to use the same project on multiple machines and without always changing the build.gradle
file, I want to have individual build directories on each machine...
Upvotes: 1
Views: 1552
Reputation: 15087
create a file camed "gradle.properties" set your desired properties in it and put it in ".gradle" folder (where your gradle is installed)
in linux ".gradle" is normally in "/home/[]your_user_name]/.gradle"
then in android view of project structure of all your project this file will appear with the name "gradle.properties (Global Properties)"
UPADATE:
if you want a global script file rather than properties file you can use init script. create a file named "init.gradle" and put it in the same directory.
your init.gradle content would be like:
allprojects {
buildDir = "whatever directory you want"
}
Upvotes: 1