When building certain code with bazel I'm running out of storage space. I'd like bazel to store it's things on a USB drive instead of in my ~/.cache
folder. How can I tell bazel to do this?
Use the --output_user_root
flag.
Example:
bazel --output_user_root=/path/to/directory build //foo:bar
You can change the outputRoot directory by changing the $TEST_TMPDIR
variable.
export TEST_TMPDIR=/path/to/directory
From the bazel docs:
The outputRoot directory is
~/.cache/bazel
. (Unless $TEST_TMPDIR is set, as in a test of bazel itself, in which case this directory is used instead.)
来源:https://stackoverflow.com/questions/40775920/how-can-i-make-bazel-use-external-storage-when-building