write_vcsrevision.gni
1.38 KB
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
# This file introduces a templates for calling write_vcsrevision.py.
#
# Parameters:
#
# header (required) [string]
#
# names (optional) [list of strings]
# Writes "$foo_REVISION" and "$foo_REPOSITORY" for each foo in names.
# Defaults to [ "LLVM" ]
declare_args() {
# If this set to false, VCSRevision.h is updated after every git commit.
# That's technically correct, but results in rebuilds after every commit.
# If it's true (default), VCSRevision.h will usually be somewhat
# out-of-date, but builds will be faster.
llvm_allow_tardy_revision = true
}
template("write_vcsrevision") {
assert(defined(invoker.header), "must set 'header' in $target_name")
action("write_vcsrevision") {
script = "//llvm/utils/gn/build/write_vcsrevision.py"
header = invoker.header
if (defined(invoker.names)) {
names = invoker.names
} else {
names = [ "LLVM" ]
}
args = [ rebase_path(header, root_build_dir) ]
if (!llvm_allow_tardy_revision) {
depfile = "$header.d"
args += [
"-d",
rebase_path(depfile, root_build_dir),
]
}
foreach(name, names) {
args += [ "--name=$name" ]
}
outputs = [
header,
]
forward_variables_from(invoker,
[
"public_configs",
"visibility",
])
}
}