Allow node.py to run any node script
In DevTools, we want to write Node scripts as part of our Ninja action scripts. That's because we are more familiar with Node than with Python. However, since Ninja only allows Python scripts to be a script of an `action`, we were previously forced to write Python. This change allows the `third_party/node/node.py` script to be used as if it was a regular `node <script args>` invocation. As a result, we can use this script as part of a Ninja action as follows: ``` action(target_name) { script = "//third_party/node/node.py" args = [ "path/to/my/node/script.js", "--any-arg", anyValueForArg, ] } ``` We were previously already using this in DevTools itself, but that requires a Node checkout in `third_party/devtools-frontend/src/third_party/node`. To make sure that a build in Chromium is possible as well, we need to reference the absolute path to `//third_party/node/node.py` and thus requires the same file to exist in Chromium itself. Additionally, the script would now fail with the exitcode as defined by the invoked Node script. Lastly, this CL reformats the script according to the Python formatting standard. Bug: 1096473 R=jacktfranklin@chromium.org,dpapad@chromium.org CC=devtools-reviews+blink@chromium.org Change-Id: Ie11150475d4d32c9dc9e8ec18228d490239ff7c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248568Reviewed-by:dpapad <dpapad@chromium.org> Reviewed-by:
Dirk Pranke <dpranke@google.com> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Cr-Commit-Position: refs/heads/master@{#780723}
Showing
Please register or sign in to comment