Skip to content

Commit e9debff

Browse files
authored
build: use local bazel installation in test script watch mode (#18512)
Currently the test script uses the global Bazel installation in watch mode and the local one in non-watch mode. These changes fix it so we also use the local installation for watch mode.
1 parent 82d0bd1 commit e9debff

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
"postinstall": "node tools/postinstall/apply-patches.js && ngcc --properties main --create-ivy-entry-points && node tools/postinstall/update-ngcc-main-fields.js",
1717
"build": "node ./scripts/build-packages-dist.js",
1818
"bazel": "bazelisk",
19+
"ibazel": "node ./scripts/ibazel.js",
1920
"bazel:buildifier": "find . -type f \\( -name \"*.bzl\" -or -name WORKSPACE -or -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs buildifier -v --warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,constant-glob,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,load,load-on-top,native-build,native-package,output-group,package-name,package-on-top,redefined-variable,repository-name,same-origin-load,string-iteration,unused-variable,unsorted-dict-items,out-of-order-load",
2021
"bazel:format-lint": "yarn -s bazel:buildifier --lint=warn --mode=check",
21-
"dev-app": "ibazel run //src/dev-app:devserver",
22+
"dev-app": "yarn -s ibazel run //src/dev-app:devserver",
2223
"test": "node ./scripts/run-component-tests.js",
2324
"test-local": "yarn -s test --local",
2425
"test-firefox": "yarn -s test --firefox",

scripts/ibazel.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Temporary wrapper script which makes sure that the proper, locally-installed, binary is used when
2+
// running ibazel. Currently ibazel only looks for bazel in the PATH or @bazel/bazel, but not in
3+
// @bazel/bazelisk. See: https://github.com/bazelbuild/bazel-watcher/issues/339
4+
const shelljs = require('shelljs');
5+
const path = require('path');
6+
const ibazelLocalBinary = path.resolve('./node_modules/.bin/ibazel');
7+
const bazelLocalBinary = require('@bazel/bazelisk/bazelisk.js').getNativeBinary();
8+
const args = process.argv.slice(2).join(' ');
9+
10+
shelljs.exec(`${ibazelLocalBinary} -bazel_path ${bazelLocalBinary} ${args}`);

0 commit comments

Comments
 (0)