1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[gn build] Make config_map computation in llvm-lit more table-driven.

No behavior change.
This commit is contained in:
Nico Weber 2020-05-11 19:21:31 -04:00
parent 92c330d982
commit f35557899b

View File

@ -17,13 +17,6 @@ write_cmake_config("llvm-lit") {
# lit's lit/llvm/config.py shells out to llvm-config.
deps = [ "//llvm/tools/llvm-config" ]
# Generate LLVM_LIT_CONFIG_MAP parameter.
# llvm-lit contains a mapping from each lit.cfg.py file to the corresponding
# generated llvm.site.cfg.py file, so llvm-lit depends on all the targets to
# generate the site.cfg.py file.
# FIXME: Write relative paths for path()s.
config_map = "def path(p): return p if p else \"\"\n"
deps += [
"//clang-tools-extra/test:lit_site_cfg",
"//clang-tools-extra/test:lit_unit_site_cfg",
@ -35,31 +28,61 @@ write_cmake_config("llvm-lit") {
"//llvm/test:lit_unit_site_cfg",
]
# Note: \n is converted into a newline by write_cmake_config.py, not by gn.
config_map +=
"map_config('" + rebase_path("//clang-tools-extra/test/lit.cfg.py") +
"', '" + rebase_path(clang_tools_extra_lit_site_cfg_file) + "')\n"
config_map +=
"map_config('" + rebase_path("//clang-tools-extra/test/Unit/lit.cfg.py") +
"', '" + rebase_path(clang_tools_extra_lit_unit_site_cfg_file) + "')\n"
config_map += "map_config('" +
rebase_path("//clang-tools-extra/clangd/test/lit.cfg.py") +
"', '" + rebase_path(clangd_lit_site_cfg_file) + "')\n"
config_map += "map_config('" +
rebase_path("//clang-tools-extra/clang/unittests/lit.cfg.py") +
"', '" + rebase_path(clangd_lit_unit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//clang/test/lit.cfg.py") +
"', '" + rebase_path(clang_lit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//clang/test/Unit/lit.cfg.py") +
"', '" + rebase_path(clang_lit_unit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//lld/test/lit.cfg.py") + "', '" +
rebase_path(lld_lit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//lld/test/Unit/lit.cfg.py") +
"', '" + rebase_path(lld_lit_unit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//llvm/test/lit.cfg.py") +
"', '" + rebase_path(llvm_lit_site_cfg_file) + "')\n"
config_map += "map_config('" + rebase_path("//llvm/test/Unit/lit.cfg.py") +
"', '" + rebase_path(llvm_lit_unit_site_cfg_file) + "')\n"
entries = [
[
"//clang-tools-extra/test/lit.cfg.py",
clang_tools_extra_lit_site_cfg_file,
],
[
"//clang-tools-extra/test/Unit/lit.cfg.py",
clang_tools_extra_lit_unit_site_cfg_file,
],
[
"//clang-tools-extra/clangd/test/lit.cfg.py",
clangd_lit_site_cfg_file,
],
[
"//clang-tools-extra/clangd/unittests/lit.cfg.py",
clangd_lit_unit_site_cfg_file,
],
[
"//clang/test/lit.cfg.py",
clang_lit_site_cfg_file,
],
[
"//clang/test/Unit/lit.cfg.py",
clang_lit_unit_site_cfg_file,
],
[
"//lld/test/lit.cfg.py",
lld_lit_site_cfg_file,
],
[
"//lld/test/Unit/lit.cfg.py",
lld_lit_unit_site_cfg_file,
],
[
"//llvm/test/lit.cfg.py",
llvm_lit_site_cfg_file,
],
[
"//llvm/test/Unit/lit.cfg.py",
llvm_lit_unit_site_cfg_file,
],
]
# Generate LLVM_LIT_CONFIG_MAP parameter.
# llvm-lit contains a mapping from each lit.cfg.py file to the corresponding
# generated llvm.site.cfg.py file, so llvm-lit depends on all the targets to
# generate the site.cfg.py file.
# Note: \n is converted to a newline by write_cmake_config.py, not by gn.
# FIXME: Write relative paths for path()s.
config_map = "def path(p): return p if p else \"\"\n"
foreach(entry, entries) {
config_map += "map_config('" + rebase_path(entry[0]) + "', '" +
rebase_path(entry[1]) + "')\n"
}
values = [
"LLVM_SOURCE_DIR=" + rebase_path("//llvm"),