Skip to content

Commit

Permalink
build: Enable custom ccache cache dir for Android
Browse files Browse the repository at this point in the history
During lunch, check environment variables for ANDROID_CCACHE_DIR.
If it is specified, CCACHE_DIR is set to match. Prevents issues
with multiple versions of ccache writing to the same cache dir.

ANDROID_CCACHE_SIZE should also be specified, allowing for a distinct
cache directory size from the default. Syntax for ANDROID_CCACHE_SIZE
is the same as applied in the command: 'ccache -M$ANDROID_CCACHE_SIZE'

Change-Id: I17497a6f56347850e0fa7b8ebd4de0b5a0b13e55
  • Loading branch information
mdmower authored and Gerrit Code Review committed Aug 14, 2015
1 parent 64d3073 commit ba7e53f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/combo/select.mk
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ ifneq ($(USE_CCACHE),)
ifndef CXX_WRAPPER
CXX_WRAPPER := $(ccache)
endif
ifeq ($(ANDROID_CCACHE_DIR), $(CCACHE_DIR))
ifneq ($(ANDROID_CCACHE_SIZE),)
ACCSIZE_RESULT := $(shell $(ccache) -M$(ANDROID_CCACHE_SIZE))
endif
endif
ccache =
ACCSIZE_RESULT =
endif
endif

Expand Down
4 changes: 4 additions & 0 deletions envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ function setpaths()
unset ANDROID_HOST_OUT
export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT)
if [ -n "$ANDROID_CCACHE_DIR" ]; then
export CCACHE_DIR=$ANDROID_CCACHE_DIR
fi
# needed for building linux on MacOS
# TODO: fix the path
#export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
Expand Down

0 comments on commit ba7e53f

Please sign in to comment.