build: consolidate gn templates (#34918)
This commit is contained in:
parent
3c7d446fad
commit
1b96a3aa1d
3 changed files with 50 additions and 47 deletions
|
@ -1,33 +1,22 @@
|
||||||
import("node.gni")
|
template("node_action") {
|
||||||
|
assert(defined(invoker.script), "Need script path to run")
|
||||||
|
assert(defined(invoker.args), "Need script arguments")
|
||||||
|
|
||||||
# TODO(MarshallOfSound): Move to electron/node, this is the only place it is used now
|
|
||||||
# Run an action with a given working directory. Behaves identically to the
|
|
||||||
# action() target type, with the exception that it changes directory before
|
|
||||||
# running the script.
|
|
||||||
#
|
|
||||||
# Parameters:
|
|
||||||
# cwd [required]: Directory to change to before running the script.
|
|
||||||
template("chdir_action") {
|
|
||||||
action(target_name) {
|
action(target_name) {
|
||||||
forward_variables_from(invoker,
|
forward_variables_from(invoker,
|
||||||
"*",
|
|
||||||
[
|
[
|
||||||
"script",
|
"deps",
|
||||||
"args",
|
"public_deps",
|
||||||
|
"sources",
|
||||||
|
"inputs",
|
||||||
|
"outputs",
|
||||||
])
|
])
|
||||||
assert(defined(cwd), "Need cwd in $target_name")
|
if (!defined(inputs)) {
|
||||||
script = "//electron/build/run-in-dir.py"
|
inputs = []
|
||||||
if (defined(sources)) {
|
|
||||||
sources += [ invoker.script ]
|
|
||||||
} else {
|
|
||||||
assert(defined(inputs))
|
|
||||||
inputs += [ invoker.script ]
|
|
||||||
}
|
}
|
||||||
args = [
|
inputs += [ invoker.script ]
|
||||||
rebase_path(cwd),
|
script = "//electron/build/run-node.py"
|
||||||
rebase_path(invoker.script),
|
args = [ rebase_path(invoker.script) ] + invoker.args
|
||||||
]
|
|
||||||
args += invoker.args
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
template("node_action") {
|
|
||||||
assert(defined(invoker.script), "Need script path to run")
|
|
||||||
assert(defined(invoker.args), "Need script arguments")
|
|
||||||
|
|
||||||
action(target_name) {
|
|
||||||
forward_variables_from(invoker,
|
|
||||||
[
|
|
||||||
"deps",
|
|
||||||
"public_deps",
|
|
||||||
"sources",
|
|
||||||
"inputs",
|
|
||||||
"outputs",
|
|
||||||
])
|
|
||||||
if (!defined(inputs)) {
|
|
||||||
inputs = []
|
|
||||||
}
|
|
||||||
inputs += [ invoker.script ]
|
|
||||||
script = "//electron/build/run-node.py"
|
|
||||||
args = [ rebase_path(invoker.script) ] + invoker.args
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,12 +7,12 @@ This adds GN build files for Node, so we don't have to build with GYP.
|
||||||
|
|
||||||
diff --git a/BUILD.gn b/BUILD.gn
|
diff --git a/BUILD.gn b/BUILD.gn
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..4afca42d22ee702af50da92aa08c1de897891424
|
index 0000000000000000000000000000000000000000..9e34a074cfa7dec61c4e11821ba5f1969f393dfb
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/BUILD.gn
|
+++ b/BUILD.gn
|
||||||
@@ -0,0 +1,403 @@
|
@@ -0,0 +1,403 @@
|
||||||
+import("//electron/build/asar.gni")
|
|
||||||
+import("//v8/gni/v8.gni")
|
+import("//v8/gni/v8.gni")
|
||||||
|
+import("node.gni")
|
||||||
+
|
+
|
||||||
+declare_args() {
|
+declare_args() {
|
||||||
+ # Enable the V8 inspector protocol for use with node.
|
+ # Enable the V8 inspector protocol for use with node.
|
||||||
|
@ -1593,6 +1593,41 @@ index 0000000000000000000000000000000000000000..a2cfdffcd7308b73c5c302ebc4b946c6
|
||||||
+ "//v8/include/v8.h"
|
+ "//v8/include/v8.h"
|
||||||
+ ]
|
+ ]
|
||||||
+}
|
+}
|
||||||
|
diff --git a/node.gni b/node.gni
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..9b1a4048a4a64c36d88de0bbe1a548c906aaa22c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/node.gni
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+# Run an action with a given working directory. Behaves identically to the
|
||||||
|
+# action() target type, with the exception that it changes directory before
|
||||||
|
+# running the script.
|
||||||
|
+#
|
||||||
|
+# Parameters:
|
||||||
|
+# cwd [required]: Directory to change to before running the script.
|
||||||
|
+template("chdir_action") {
|
||||||
|
+ action(target_name) {
|
||||||
|
+ forward_variables_from(invoker,
|
||||||
|
+ "*",
|
||||||
|
+ [
|
||||||
|
+ "script",
|
||||||
|
+ "args",
|
||||||
|
+ ])
|
||||||
|
+ assert(defined(cwd), "Need cwd in $target_name")
|
||||||
|
+ script = "//electron/build/run-in-dir.py"
|
||||||
|
+ if (defined(sources)) {
|
||||||
|
+ sources += [ invoker.script ]
|
||||||
|
+ } else {
|
||||||
|
+ assert(defined(inputs))
|
||||||
|
+ inputs += [ invoker.script ]
|
||||||
|
+ }
|
||||||
|
+ args = [
|
||||||
|
+ rebase_path(cwd),
|
||||||
|
+ rebase_path(invoker.script),
|
||||||
|
+ ]
|
||||||
|
+ args += invoker.args
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
|
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb3048361d9d591
|
index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb3048361d9d591
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue