Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 1 | load("@bazel_skylib//rules:write_file.bzl", "write_file") |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 2 | load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain") |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 3 | |
| 4 | write_file( |
| 5 | name = "noop_error_exit", |
| 6 | out = "noop_error_exit.sh", |
| 7 | content = [ |
| 8 | "#!/bin/bash", |
| 9 | "echo 'This should never be executed. Something went wrong.' >&2", |
| 10 | "echo 'This NOOP NodeJs toolchain should never be executed. Something went wrong.' >&2", |
| 11 | "echo 'Check that your target has `target_compatible_with` set to a platform that supports NodeJs.' >&2", |
| 12 | "exit 1", |
| 13 | ], |
| 14 | is_executable = True, |
| 15 | ) |
| 16 | |
| 17 | node_toolchain( |
| 18 | name = "noop_node_toolchain_impl", |
| 19 | target_tool = ":noop_error_exit", |
| 20 | ) |
| 21 | |
| 22 | toolchain( |
| 23 | name = "noop_node_toolchain", |
| 24 | exec_compatible_with = [ |
| 25 | "@platforms//os:linux", |
| 26 | ], |
| 27 | target_compatible_with = [ |
| 28 | "//tools/platforms/nodejs:lacks_support", |
| 29 | ], |
| 30 | toolchain = ":noop_node_toolchain_impl", |
Philipp Schrader | 175a93c | 2023-02-19 13:13:40 -0800 | [diff] [blame] | 31 | toolchain_type = "@rules_nodejs//nodejs:toolchain_type", |
Philipp Schrader | 5404796 | 2022-02-16 21:05:11 -0800 | [diff] [blame] | 32 | ) |