pw_presubmit: Add message about the Bazel cache

Sometimes the Bazel cache gets in a bad state where it complains about
undeclared inclusions on C standard library headers. The only way to fix
this is to delete the Bazel cache. This adds a message to the presubmit
about how to clear the cache if the Bazel build fails.

Fixed: 114
Change-Id: I7c3ad45bdce919a325f721f2071e99c1e56582c0
This commit is contained in:
Wyatt Hepler 2020-02-04 12:24:07 -08:00 committed by CQ Bot Account
parent bab0e20539
commit 6908e47768

View File

@ -280,15 +280,21 @@ CMAKE = (cmake_tests, )
#
@filter_paths(endswith=(*format_code.C_FORMAT.extensions, '.bzl', 'BUILD'))
def bazel_test(ctx: PresubmitContext):
call('bazel',
'test',
'//...',
'--verbose_failures',
'--verbose_explanations',
'--worker_verbose',
'--symlink_prefix',
ctx.output_directory.joinpath('bazel-'),
cwd=ctx.repository_root)
try:
call('bazel',
'test',
'//...',
'--verbose_failures',
'--verbose_explanations',
'--worker_verbose',
'--symlink_prefix',
ctx.output_directory.joinpath('bazel-'),
cwd=ctx.repository_root)
except:
_LOG.info('If the Bazel build inexplicably fails while the '
'other builds are passing, try deleting the Bazel cache:\n'
' rm -rf ~/.cache/bazel')
raise
BAZEL = (bazel_test, )