build: depend on bazelisk rather than directly on Bazel (#36078)

This has a couple benefits:
- we now use a .bazelversion file rather than package.json to pin the version of bazel we want. This means even if you install bazel on your computer rather than via yarn, you'll still get a warning if your bazel version is wrong.
- you no longer end up downloading three copies of bazel due to bugs in both npm and yarn where they download all tarballs before checking the metadata to see which are usable on the local platform.
- bazelisk correctly handles the tools/bazel trick for wrapping functionality, which we want to use to instrument developer build latencies

PR Close #36078
This commit is contained in:
Alex Eagle
2020-02-04 16:14:21 -08:00
committed by Andrew Kushnir
parent 31bec8ce61
commit 46fe8fb8b4
18 changed files with 323 additions and 542 deletions

View File

@ -17,6 +17,9 @@ const VERBOSE_LOGS = !!process.env['VERBOSE_LOGS'];
// Set to true if you want the /tmp folder created to persist after running `bazel test`
const KEEP_TMP = false;
// bazelisk requires a $HOME environment variable for its cache
process.env['HOME'] = tmp.dirSync({keep: KEEP_TMP, unsafeCleanup: !KEEP_TMP}).name;
function fail(...m) {
console.error();
console.error(`[${path.basename(__filename)}]`);