From 406bf380c96b55d20ca36f00e937f94adb4e5dbf Mon Sep 17 00:00:00 2001 From: rlb Date: Mon, 4 Aug 2025 13:47:22 -0700 Subject: [PATCH] feat: RUNFILES_DIR compatibility Add this environment variable in line with https://docs.google.com/document/d/e/2PACX-1vSDIrFnFvEYhKsCMdGdD40wZRBX3m3aZ5HhVj4CtHPmiXKDCxioTUbYsDydjKtFDAzER5eg7OjJWs3V/pub For compatibility with existing users and workarounds, the variable is conditionally exported. --- js/private/js_binary.sh.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/private/js_binary.sh.tpl b/js/private/js_binary.sh.tpl index 969c0501b..9e30d2edc 100644 --- a/js/private/js_binary.sh.tpl +++ b/js/private/js_binary.sh.tpl @@ -150,6 +150,12 @@ trap _exit EXIT export RUNFILES JS_BINARY__RUNFILES="$RUNFILES" export JS_BINARY__RUNFILES +# Set RUNFILES_DIR for compatibility with languages obeying the design laid out in +# https://github.com/bazelbuild/bazel/issues/4460 +if [ -z "${RUNFILES_DIR:-}" ]; then + RUNFILES_DIR="$RUNFILES" +fi +export RUNFILES_DIR # ============================================================================== # Prepare to run main program