forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasar.gni
60 lines (56 loc) · 1.74 KB
/
asar.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import("node.gni")
# 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) {
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
}
}
template("asar") {
assert(defined(invoker.sources),
"Need sources in $target_name listing the source files")
assert(defined(invoker.outputs),
"Need asar name (as 1-element array, e.g. \$root_out_dir/foo.asar)")
assert(defined(invoker.root), "Need the base dir for generating the ASAR")
node_action(target_name) {
forward_variables_from(invoker,
"*",
[
"script",
"args",
])
script = "//electron/script/gn-asar.js"
args = [
"--base",
rebase_path(root),
"--files",
] + rebase_path(sources) +
[
"--out",
rebase_path(outputs[0]),
]
}
}