Skip to content

Commit 45a36cb

Browse files
aidanwolter3arcady-lunarg
authored andcommitted
[fuchsia] Use resolved git HEAD path for build info
Update BUILD.gn to redirect glslang_build_info to the default toolchain when building in the Fuchsia tree, and use the resolved git HEAD path from git_revisions.gni. This ensures the action reruns when the HEAD changes, even in a git worktree.
1 parent 06c2670 commit 45a36cb

1 file changed

Lines changed: 36 additions & 21 deletions

File tree

BUILD.gn

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,40 @@ if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
4949
_configs_to_add = [ "//build/config/compiler:no_chromium_code" ]
5050
}
5151

52-
action("glslang_build_info") {
53-
script = "build_info.py"
52+
if (current_toolchain == default_toolchain) {
53+
if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
54+
import("//build/git/git_revisions.gni")
55+
}
5456

55-
src_dir = "."
56-
changes_file = "CHANGES.md"
57-
template_file = "build_info.h.tmpl"
58-
out_file = "${target_gen_dir}/include/glslang/build_info.h"
57+
action("glslang_build_info") {
58+
script = "build_info.py"
5959

60-
inputs = [
61-
changes_file,
62-
script,
63-
template_file,
64-
]
65-
outputs = [ out_file ]
66-
args = [
67-
rebase_path(src_dir, root_build_dir),
68-
"-i",
69-
rebase_path(template_file, root_build_dir),
70-
"-o",
71-
rebase_path(out_file, root_build_dir),
72-
]
60+
src_dir = "."
61+
changes_file = "CHANGES.md"
62+
template_file = "build_info.h.tmpl"
63+
out_file = "${target_gen_dir}/include/glslang/build_info.h"
64+
65+
inputs = [
66+
changes_file,
67+
script,
68+
template_file,
69+
]
70+
if (defined(is_fuchsia_tree) && is_fuchsia_tree) {
71+
inputs += [ git_paths.glslang_head ]
72+
}
73+
outputs = [ out_file ]
74+
args = [
75+
rebase_path(src_dir, root_build_dir),
76+
"-i",
77+
rebase_path(template_file, root_build_dir),
78+
"-o",
79+
rebase_path(out_file, root_build_dir),
80+
]
81+
}
82+
} else {
83+
group("glslang_build_info") {
84+
public_deps = [ ":glslang_build_info($default_toolchain)" ]
85+
}
7386
}
7487

7588
action("glslang_extension_headers") {
@@ -273,7 +286,8 @@ template("glslang_sources_common") {
273286
]
274287
}
275288

276-
include_dirs = [ "${target_gen_dir}/include" ]
289+
include_dirs = [ get_label_info(":glslang_build_info($default_toolchain)",
290+
"target_gen_dir") + "/include" ]
277291

278292
deps = [ ":glslang_build_info" ]
279293

@@ -336,7 +350,8 @@ executable("glslang_validator") {
336350
}
337351

338352
include_dirs = [
339-
"${target_gen_dir}/include",
353+
get_label_info(":glslang_build_info($default_toolchain)",
354+
"target_gen_dir") + "/include",
340355
"${spirv_tools_dir}/include",
341356
]
342357

0 commit comments

Comments
 (0)