2013年2月2日 星期六

[Tool] 使用ccache可以加快build code的速度

在build android的source code,如果電腦硬體不夠好時,往往會build很久,google非常的貼心,針對此情況提供了ccache的機制可以減少編譯的時間,通常第一次clean build會花比較久時間,往後就會節省大約20%的時間,提升開發的效率。

●添加環境變數
export USE_CCACHE=1
●建立緩存的目錄
export CCACHE_DIR=<path-to-your-cache-directory>
●設定緩存的空間
prebuilts/misc/linux-x86/ccache/ccache -M 50G


其他可以使用的參數選項如下所示:

Usage:
ccache [options]
ccache compiler [compile options]
compiler [compile options] (via symbolic link)

Options:
-s show statistics summary
-z zero statistics
-c run a cache cleanup
-C clear the cache completely
-F <maxfiles> set maximum files in cache
-M <maxsize> set maximum size of cache (use G, M or K)
-h this help page
-V print version number

相關網頁
1.Initializing a Build Environment

沒有留言 :

張貼留言