[llvm] fd20ec6 - [gn build] (manually) port 89cd86bbc58a (clang-pseudo move)
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 17:45:45 PDT 2022
Author: Nico Weber
Date: 2022-03-15T20:45:36-04:00
New Revision: fd20ec6b6edaa8436a9861b770297c855d91ceea
URL: https://github.com/llvm/llvm-project/commit/fd20ec6b6edaa8436a9861b770297c855d91ceea
DIFF: https://github.com/llvm/llvm-project/commit/fd20ec6b6edaa8436a9861b770297c855d91ceea.diff
LOG: [gn build] (manually) port 89cd86bbc58a (clang-pseudo move)
Added:
llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/BUILD.gn
llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/clang_pseudo_lit_site_cfg_files.gni
llvm/utils/gn/secondary/clang-tools-extra/pseudo/tool/BUILD.gn
llvm/utils/gn/secondary/clang-tools-extra/pseudo/unittests/BUILD.gn
Modified:
llvm/utils/gn/secondary/BUILD.gn
llvm/utils/gn/secondary/clang/test/BUILD.gn
llvm/utils/gn/secondary/clang/unittests/BUILD.gn
llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
Removed:
llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/Pseudo/BUILD.gn
llvm/utils/gn/secondary/clang/tools/clang-pseudo/BUILD.gn
llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/Pseudo/BUILD.gn
################################################################################
diff --git a/llvm/utils/gn/secondary/BUILD.gn b/llvm/utils/gn/secondary/BUILD.gn
index 827a61b73a006..ce1a02967c2f3 100644
--- a/llvm/utils/gn/secondary/BUILD.gn
+++ b/llvm/utils/gn/secondary/BUILD.gn
@@ -5,6 +5,7 @@ import("//llvm/utils/gn/build/toolchain/compiler.gni")
group("default") {
deps = [
"//clang-tools-extra/clangd/test",
+ "//clang-tools-extra/pseudo/test",
"//clang-tools-extra/test",
"//clang/test",
"//clang/tools/scan-build",
diff --git a/llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/Pseudo/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/BUILD.gn
similarity index 78%
rename from llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/Pseudo/BUILD.gn
rename to llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/BUILD.gn
index 416969dd73b47..07c1d5c987e4d 100644
--- a/llvm/utils/gn/secondary/clang/lib/Tooling/Syntax/Pseudo/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/BUILD.gn
@@ -1,11 +1,12 @@
-static_library("Pseudo") {
- output_name = "clangToolingSyntaxPseudo"
+static_library("lib") {
+ output_name = "clangPseudo"
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
"//clang/lib/Basic",
"//clang/lib/Lex",
"//llvm/lib/Support",
]
+ include_dirs = [ "../include" ]
sources = [
"DirectiveMap.cpp",
"Grammar.cpp",
diff --git a/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
new file mode 100644
index 0000000000000..e58f492b37555
--- /dev/null
+++ b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
@@ -0,0 +1,93 @@
+import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/write_cmake_config.gni")
+import("clang_pseudo_lit_site_cfg_files.gni")
+
+template("write_lit_config") {
+ write_cmake_config(target_name) {
+ input = invoker.input
+ output = invoker.output
+ values = [
+ "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
+ "LLVM_LIBS_DIR=", # needed only for shared builds
+ ]
+ values += invoker.extra_values
+ }
+}
+
+write_lit_config("lit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/pseudo/test/lit.site.cfg.py.in"
+ output = clang_pseudo_lit_site_cfg_file
+
+ extra_values = [
+ "CMAKE_CURRENT_BINARY_DIR=" +
+ rebase_path(get_label_info("//clang-tools-extra/pseudo/test",
+ "target_out_dir")),
+ "CMAKE_CURRENT_SOURCE_DIR=" +
+ rebase_path("//clang-tools-extra/pseudo/test"),
+
+ "CLANG_TOOLS_DIR=",
+ "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
+ "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+ "TARGET_TRIPLE=$llvm_target_triple",
+ "Python3_EXECUTABLE=$python_path",
+ ]
+}
+
+write_lit_config("lit_unit_site_cfg") {
+ # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+ input = "//clang-tools-extra/pseudo/test/Unit/lit.site.cfg.py.in"
+ output = clang_pseudo_lit_unit_site_cfg_file
+ extra_values = [
+ "CMAKE_CURRENT_BINARY_DIR=" +
+ rebase_path(get_label_info("//clang-tools-extra/pseudo/unittests",
+ "target_out_dir")),
+ "CMAKE_CURRENT_SOURCE_DIR=" +
+ rebase_path("//clang-tools-extra/pseudo/test"),
+ ]
+ if (host_os == "win") {
+ # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
+ extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
+ } else {
+ extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
+ }
+}
+
+# This target should contain all dependencies of check-pseudo.
+# //:default depends on it, so that ninja's default target builds all
+# prerequisites for check-clang but doesn't run check-clang itself.
+group("test") {
+ deps = [
+ ":lit_site_cfg",
+ ":lit_unit_site_cfg",
+ "//clang-tools-extra/pseudo/tool:clang-pseudo",
+ "//clang-tools-extra/pseudo/unittests:ClangPseudoTests",
+ "//llvm/utils/FileCheck",
+ "//llvm/utils/llvm-lit",
+ "//llvm/utils/not",
+ ]
+ testonly = true
+}
+
+action("check-clang-pseudo") {
+ script = "$root_out_dir/bin/llvm-lit"
+ if (host_os == "win") {
+ script += ".py"
+ }
+ args = [
+ "-sv",
+ rebase_path(get_path_info(clang_pseudo_lit_site_cfg_file, "dir"),
+ root_out_dir),
+ ]
+ outputs = [ "$target_gen_dir/run-lit" ] # Non-existing, so that ninja runs it
+ # each time.
+
+ # Since check-clang-pseudo is always dirty, //:default doesn't depend on it so
+ # that it's not part of the default ninja target. Hence, check-clang-pseudo
+ # shouldn't have any deps except :test. so that the default target is sure to
+ # build all the deps.
+ deps = [ ":test" ]
+ testonly = true
+
+ pool = "//:console"
+}
diff --git a/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/clang_pseudo_lit_site_cfg_files.gni b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/clang_pseudo_lit_site_cfg_files.gni
new file mode 100644
index 0000000000000..ca469e5478442
--- /dev/null
+++ b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/clang_pseudo_lit_site_cfg_files.gni
@@ -0,0 +1,4 @@
+clang_pseudo_lit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/pseudo/test/lit.site.cfg.py"
+clang_pseudo_lit_unit_site_cfg_file =
+ "$root_gen_dir/clang-tools-extra/pseudo/test/Unit/lit.site.cfg.py"
diff --git a/llvm/utils/gn/secondary/clang/tools/clang-pseudo/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/tool/BUILD.gn
similarity index 71%
rename from llvm/utils/gn/secondary/clang/tools/clang-pseudo/BUILD.gn
rename to llvm/utils/gn/secondary/clang-tools-extra/pseudo/tool/BUILD.gn
index ecbebd92e29df..6bdae018884f1 100644
--- a/llvm/utils/gn/secondary/clang/tools/clang-pseudo/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/tool/BUILD.gn
@@ -2,8 +2,9 @@ executable("clang-pseudo") {
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
"//clang/lib/Basic",
- "//clang/lib/Tooling/Syntax/Pseudo",
+ "//clang-tools-extra/pseudo/lib",
"//llvm/lib/Support",
]
+ include_dirs = [ "../include" ]
sources = [ "ClangPseudo.cpp" ]
}
diff --git a/llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/Pseudo/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/unittests/BUILD.gn
similarity index 82%
rename from llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/Pseudo/BUILD.gn
rename to llvm/utils/gn/secondary/clang-tools-extra/pseudo/unittests/BUILD.gn
index 4eb9fdf53a5b0..b2e05a536e0b9 100644
--- a/llvm/utils/gn/secondary/clang/unittests/Tooling/Syntax/Pseudo/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/pseudo/unittests/BUILD.gn
@@ -6,10 +6,10 @@ unittest("ClangPseudoTests") {
"//clang/lib/Basic",
"//clang/lib/Lex",
"//clang/lib/Testing",
- "//clang/lib/Tooling/Syntax/Pseudo",
+ "//clang-tools-extra/pseudo/lib",
"//llvm/lib/Support",
- "//llvm/lib/Testing/Support",
]
+ include_dirs = [ "../include" ]
sources = [
"DirectiveMapTest.cpp",
"GrammarTest.cpp",
diff --git a/llvm/utils/gn/secondary/clang/test/BUILD.gn b/llvm/utils/gn/secondary/clang/test/BUILD.gn
index 48e1f17c4fb62..f342786e0fe38 100644
--- a/llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -147,7 +147,6 @@ group("test") {
"//clang/tools/clang-format",
"//clang/tools/clang-import-test",
"//clang/tools/clang-offload-bundler",
- "//clang/tools/clang-pseudo",
"//clang/tools/clang-refactor",
"//clang/tools/clang-rename",
"//clang/tools/clang-repl",
diff --git a/llvm/utils/gn/secondary/clang/unittests/BUILD.gn b/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
index d33e5d7b4cae2..5521995270c38 100644
--- a/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
@@ -21,7 +21,6 @@ group("unittests") {
"Serialization:SerializationTests",
"Tooling:ToolingTests",
"Tooling/Syntax:SyntaxTests",
- "Tooling/Syntax/Pseudo:ClangPseudoTests",
]
if (clang_enable_static_analyzer) {
deps += [
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 aa0c5f84c2d9a..2e43ec0ef63d7 100644
--- a/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
@@ -1,4 +1,5 @@
import("//clang-tools-extra/clangd/test/clangd_lit_site_cfg_files.gni")
+import("//clang-tools-extra/pseudo/test/clang_pseudo_lit_site_cfg_files.gni")
import("//clang-tools-extra/test/clang_tools_extra_lit_site_cfg_files.gni")
import("//clang/test/clang_lit_site_cfg_files.gni")
import("//lld/test/lld_lit_site_cfg_files.gni")
@@ -22,6 +23,10 @@ write_cmake_config("llvm-lit") {
deps += [
"//clang-tools-extra/test:lit_site_cfg",
"//clang-tools-extra/test:lit_unit_site_cfg",
+ "//clang-tools-extra/clangd/test:lit_site_cfg",
+ "//clang-tools-extra/clangd/test:lit_unit_site_cfg",
+ "//clang-tools-extra/pseudo/test:lit_site_cfg",
+ "//clang-tools-extra/pseudo/test:lit_unit_site_cfg",
"//clang/test:lit_site_cfg",
"//clang/test:lit_unit_site_cfg",
"//lld/test:lit_site_cfg",
@@ -51,6 +56,14 @@ write_cmake_config("llvm-lit") {
"//clang-tools-extra/clangd/unittests/lit.cfg.py",
clangd_lit_unit_site_cfg_file,
],
+ [
+ "//clang-tools-extra/pseudo/test/lit.cfg.py",
+ clang_pseudo_lit_site_cfg_file,
+ ],
+ [
+ "//clang-tools-extra/pseudo/test/Unit/lit.cfg.py",
+ clang_pseudo_lit_unit_site_cfg_file,
+ ],
[
"//clang/test/lit.cfg.py",
clang_lit_site_cfg_file,
More information about the llvm-commits
mailing list