Skip to content

Commit 83da73f

Browse files
authored
build: fix devserver sh_binary not working on systems with runfiles enabled (#23721)
The devserver currently does not work on systems with runfiles enabled. This is commonly macOS and Linux. The devserver breaks here because we do not have a runfile tree directory built as this would cause a significant slow-down for RBE and caching. This commit ensures the runfile manifest is consulted _always_, unless the dev-server runs in a test where a runfile directory is resolved to the test directory. Inside the test action, with runfiles enabled, there would be no runfile manifest file.. causing the devserver to fail. e.g. ``` /b/f/w/bazel-out/k8-fastbuild/bin/src/material-experimental/mdc-table/e2e_tests_chromium.sh.runfiles/angular_material/tools/dev-server/dev-server_bin.sh: line 52: RUNFILES_MANIFEST_FILE: unbound variable ```
1 parent 2bd36cf commit 83da73f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/dev-server/launcher_template.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/
1414
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
1515
# --- end runfiles.bash initialization v2 ---
1616

17+
# If we do not run the devserver as part of a test, we always enforce runfile
18+
# resolution when invoking the devserver NodeJS binary. This is necessary as
19+
# runfile trees are disabled as part of this repository. The devserver NodeJS
20+
# binary would not find a relative runfile tree directory and error out.
21+
if [[ -z "${TEST_SRCDIR:-""}" ]]; then
22+
export RUNFILES_MANIFEST_ONLY="1"
23+
fi
24+
1725
# Resolve the path of the dev-server binary. Note: usually we either need to
1826
# resolve the "nodejs_binary" executable with different file extensions on
1927
# windows, but since we already run this launcher as part of a "sh_binary", we

0 commit comments

Comments
 (0)