# Copyright 2020 The Chromium Authors.  All rights reserved.
# 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,
                           [
                             "visibility",
                             "deps",
                             "public_deps",
                             "outputs",
                             "sources",
                             "inputs",
                             "testonly",
                           ])

    _full_script_location = devtools_location_prepend + invoker.script

    inputs += [ _full_script_location ]

    args = [ rebase_path(_full_script_location, root_build_dir) ] + invoker.args
  }
}

set_defaults("node_action") {
  inputs = []

  args = []
}
