摇篮全球build目录 [英] Gradle global build directory
问题描述
我想知道的是它可以配置摇篮使用一个全球性建立所有项目
目录?我需要这个,因为我存储在谷歌云端硬盘文件夹我的所有项目(用于备份和其他设备快速存取),当我建项目谷歌驱动器加载CPU在同步项目建立
目录。所以,我想搬到谷歌驱动器以外建立
目录。
I want to know is it possible to configure Gradle to use one global build
directory for all projects? I need this because I store all my projects in Google Drive folder (for backup and fast access from other devices) and when I build project Google Drive is loading CPU while syncing project build
directory. So I want to move build
directories outside of Google Drive.
另外这个选项将是对于那些谁想要使用RAM磁盘作为存储建立
目录下建的项目非常有用。
Also this option will be useful for those who want to build projects using RAM disk as storage for build
directory.
推荐答案
感谢彼得Niederwieser。我决定后,因为其他细节我自己的答案。
Thanks to Peter Niederwieser. I decided to post my own answer because of additional details.
要设置全球build目录,你需要将这些行添加到〜/ .gradle / init.gradle
:
To setup global build directory you need to add these lines to ~/.gradle/init.gradle
:
gradle.projectsLoaded {
rootProject.allprojects {
buildDir = "/path/to/build/${rootProject.name}/${project.name}"
}
}
不错的选择产生全球性构建RAM磁盘上
目录。所以,如果你的OS X的用户可以用做:
Nice option to have global build
directory on the RAM disk. So if you OS X user you can do this with:
diskutil erasevolume HFS+ 'RAMDiskName' `hdiutil attach -nomount ram://XXXXXX`
其中, XXXXXX
是512字节块计数(例如,它为262114 128MB RAM磁盘)
where XXXXXX
is a count of 512-byte blocks (for example, it's 262114 for 128MB RAM disk)
和 buildDir
行将是:
buildDir = "/Volumes/RAMDiskName/${rootProject.name}/${project.name}"
这篇关于摇篮全球build目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!