From d8a1f6c637a9f5dfb215563bda1a7877cfcbe919 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Wed, 27 Apr 2022 13:13:53 -0400 Subject: [PATCH] [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue (#1037) * [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue * space * specify node_js --- bazel/emscripten_toolchain/emscripten_config | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bazel/emscripten_toolchain/emscripten_config b/bazel/emscripten_toolchain/emscripten_config index 86a864b..85a98e3 100644 --- a/bazel/emscripten_toolchain/emscripten_config +++ b/bazel/emscripten_toolchain/emscripten_config @@ -3,8 +3,8 @@ import platform ROOT_DIR = os.environ["ROOT_DIR"] EMSCRIPTEN_ROOT = os.environ["EMSCRIPTEN"] -BINARYEN_ROOT = ROOT_DIR + "/" + os.environ["EM_BIN_PATH"] -LLVM_ROOT = BINARYEN_ROOT + "/bin" +BINARYEN_ROOT = os.path.join(ROOT_DIR, os.environ["EM_BIN_PATH"]) +LLVM_ROOT = os.path.join(BINARYEN_ROOT, "bin") FROZEN_CACHE = True system = platform.system() @@ -12,3 +12,12 @@ system = platform.system() machine = "arm64" if platform.machine() == "arm64" else "amd64" nodejs_binary = "bin/nodejs/node.exe" if(system =="Windows") else "bin/node" NODE_JS = ROOT_DIR + "/external/nodejs_{}_{}/{}".format(system.lower(), machine, nodejs_binary) + + +# This works around an issue with Bazel RBE where the symlinks in node_modules/.bin +# are uploaded as the linked files, which means the cli.js cannot load its +# dependencies from the expected locations. +# See https://github.com/emscripten-core/emscripten/pull/16640 for more +if system != "Windows": + CLOSURE_COMPILER = [NODE_JS, os.path.join(EMSCRIPTEN_ROOT, "node_modules", + "google-closure-compiler", "cli.js")]