背景
开启ccache 加速安卓代码编译
新的改变
- Android10的基线代码google已经将prebuilt的ccache移除,但是保留了相关功能选项
commit 326e7e2cbd95fc2b1a1f858fb29904c9d3974843
Author: Dan Willemsen <dwillemsen@google.com>
Date: Thu Apr 5 15:48:16 2018 -0700
Remove our binary of ccache
This version is rather old, and has many known bugs. The build system is
no longer providing ccache, but preserving the option to use your own at
your own risk.
Bug: 32748498
Test: cs/ccache
Change-Id: I894a11445127bf8cb3a7ac5a119c500f2c572fb9
配置
安卓10之前
export USE_CCACHE=true
export CCACHE_DIR=/data/workspace/Patch_Build_WT/.ccache(可选参数 默认用户主目录下)
prebuilts/misc/linux-x86/ccache/ccache -M 10G
安卓10
1. 由于默认代码gogle已经移除 所以需要自己安装ccache服务 deb系列的发行版apt就可以安装或者
ccache下载最新的源码编译安装 再次不废话(网上很多教材)
- 配置
export USE_CCACHE=true
export CCACHE_EXEC=/usr/bin/ccache
export CCACHE_DIR=/data/workspace/Patch_Build_WT/.ccache(可选参数 默认用户主目录下)
${CCACHE_EXEC} -M 50G
可以通过如下命令查询cache状态
ccache -s
cache directory /data/workspace/Patch_Build_WT/.ccache
primary config /data/workspace/Patch_Build_WT/.ccache/ccache.conf
secondary config (readonly) /etc/ccache.conf
cache hit (direct) 431
cache hit (preprocessed) 0
cache miss 86472
called for link 96
called for preprocessing 52
compile failed 1
preprocessor error 78
couldn't find the compiler 1
unsupported source language 4490
files in cache 156104
cache size 30.5 GB
max cache size 50.0 GB