From bccbad9bac19bbb70681c9259cb74d9ca6f9edbf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 28 Mar 2021 16:55:38 +1000 Subject: [PATCH] fix: fetch node toolchain based on exec platform, not target platform Currently rules_nodejs can't be used when cross-compiling to a different platform, if that platform does not have a node toolchain available. This means if you want to cross-compile a project that includes JS files, you need to do it in multiple steps: - build the JS files with the default host platform - build the other products with a target platform specified, copying the generated JS files in The fact that it's currently set to target makes me wonder if this use case was just not considered at the time, or whether there's some other workflow that changing to exec will break. Thoughts? --- toolchains/node/BUILD.bazel | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toolchains/node/BUILD.bazel b/toolchains/node/BUILD.bazel index 342e530342..9bfab56818 100644 --- a/toolchains/node/BUILD.bazel +++ b/toolchains/node/BUILD.bazel @@ -103,7 +103,7 @@ alias( toolchain( name = "node_linux_amd64_toolchain", - target_compatible_with = [ + exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64", ], @@ -113,7 +113,7 @@ toolchain( toolchain( name = "node_linux_arm64_toolchain", - target_compatible_with = [ + exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:aarch64", ], @@ -123,7 +123,7 @@ toolchain( toolchain( name = "node_darwin_amd64_toolchain", - target_compatible_with = [ + exec_compatible_with = [ "@platforms//os:osx", "@platforms//cpu:x86_64", ], @@ -133,7 +133,7 @@ toolchain( toolchain( name = "node_windows_amd64_toolchain", - target_compatible_with = [ + exec_compatible_with = [ "@platforms//os:windows", "@platforms//cpu:x86_64", ], @@ -143,7 +143,7 @@ toolchain( toolchain( name = "node_linux_s390x_toolchain", - target_compatible_with = [ + exec_compatible_with = [ "@platforms//os:linux", "@platforms//cpu:s390x", ],