[llvm] 11e1cf5 - [gn build] Make config_map computation in llvm-lit more table-driven.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Mon May 11 16:22:11 PDT 2020
Author: Nico Weber
Date: 2020-05-11T19:21:56-04:00
New Revision: 11e1cf51fb77c3a611b95c3f829ccdfb270b273d
URL: https://github.com/llvm/llvm-project/commit/11e1cf51fb77c3a611b95c3f829ccdfb270b273d
DIFF: https://github.com/llvm/llvm-project/commit/11e1cf51fb77c3a611b95c3f829ccdfb270b273d.diff
LOG: [gn build] Make config_map computation in llvm-lit more table-driven.
No behavior change.
Added:
Modified:
llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn b/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
index ca2ca2412cf4..d3da6fc3e930 100644
--- a/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
@@ -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"),
More information about the llvm-commits
mailing list