blob: 01579fdb7513253fc3413e1735813a51b47ab994 [file] [edit]
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("./vars.gni")
template("node_action") {
assert(defined(invoker.script),
"You must define the 'script' for a Node action")
action(target_name) {
script = "//third_party/node/node.py"
forward_variables_from(invoker,
"*",
[
"args",
"script",
])
_full_script_location = devtools_location_prepend + invoker.script
inputs += [
_full_script_location,
devtools_location_prepend + "scripts/build/ninja/write-if-changed.js",
]
if (host_os == "linux") {
inputs += [ "//third_party/node/linux/node-linux-x64/bin/node" ]
} else if (host_os == "win") {
inputs += [ "//third_party/node/win/node.exe" ]
} else if (host_os == "mac") {
if (host_cpu == "arm64") {
inputs += [ "//third_party/node/mac_arm64/node-darwin-arm64/bin/node" ]
} else {
inputs += [ "//third_party/node/mac/node-darwin-x64/bin/node" ]
}
}
args = [ rebase_path(_full_script_location, root_build_dir) ] + invoker.args
}
}
set_defaults("node_action") {
inputs = []
args = []
}