Make scouting/scouting.sh use the runfiles API
This is a followup to I5fa973c97faf53ec4149d07987f7a5f5b0066285.
In the previous patch, I updated
`scouting/testing/scouting_test_servers.py` to use the runfiles API,
but forgot about the `scouting/scouting.sh` file. This patch remedies
that.
There are no functional changes. The purpose here is to let the script
continue to work when the tests start executing from different
directories. The cypress tests will no longer execute from the root
directory. Instead, they will execute from the directory in which they
are defined.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Iaac8b3fbe76182859962e0d60a68fe3de0fe34cb
diff --git a/scouting/scouting.sh b/scouting/scouting.sh
index 669cf22..30e2989 100755
--- a/scouting/scouting.sh
+++ b/scouting/scouting.sh
@@ -2,7 +2,20 @@
# This script runs the webserver and asks it to host all the web pages.
+# --- begin runfiles.bash initialization v2 ---
+# Copy-pasted from the Bazel Bash runfiles library v2.
+set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
+source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$0.runfiles/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+# --- end runfiles.bash initialization v2 ---
+
+runfiles_export_envvars
+
exec \
- scouting/webserver/webserver_/webserver \
- -directory scouting/www/ \
+ "${RUNFILES_DIR}"/org_frc971/scouting/webserver/webserver_/webserver \
+ -directory "${RUNFILES_DIR}"/org_frc971/scouting/www/ \
"$@"