blob: 90172235298052d9e7bd8a7363b8a77a70ec9216 [file] [log] [blame]
Philipp Schrader54047962022-02-16 21:05:11 -08001load("@bazel_skylib//rules:write_file.bzl", "write_file")
Philipp Schrader175a93c2023-02-19 13:13:40 -08002load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain")
Philipp Schrader54047962022-02-16 21:05:11 -08003
4write_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
17node_toolchain(
18 name = "noop_node_toolchain_impl",
19 target_tool = ":noop_error_exit",
20)
21
22toolchain(
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 Schrader175a93c2023-02-19 13:13:40 -080031 toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
Philipp Schrader54047962022-02-16 21:05:11 -080032)