[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / utils / gn / secondary / clang-tools-extra / clangd / test / BUILD.gn
blob02ccf1de13f5dc85d19b93f8c9b00581bb6f4744
1 import("//clang-tools-extra/clangd/xpc/enable.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
4 import("//llvm/utils/gn/build/write_cmake_config.gni")
5 import("clangd_lit_site_cfg_files.gni")
7 template("write_lit_config") {
8   write_cmake_config(target_name) {
9     input = invoker.input
10     output = invoker.output
11     values = [
12       "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
13       "LLVM_LIBS_DIR=",  # needed only for shared builds
14     ]
15     values += invoker.extra_values
16   }
19 write_lit_config("lit_site_cfg") {
20   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
21   input = "//clang-tools-extra/clangd/test/lit.site.cfg.py.in"
22   output = clangd_lit_site_cfg_file
24   extra_values = [
25     "CMAKE_CURRENT_BINARY_DIR=" +
26         rebase_path(get_label_info("//clang-tools-extra/clangd/test",
27                                    "target_out_dir")),
28     "CMAKE_CURRENT_SOURCE_DIR=" +
29         rebase_path("//clang-tools-extra/clangd/test"),
31     "CLANG_LIBS_DIR=",  # needed only for shared builds
32     "CLANG_TOOLS_DIR=",
33     "CLANGD_ENABLE_REMOTE=0",
34     "CLANGD_TIDY_CHECKS=1",
35     "LLVM_HOST_TRIPLE=$llvm_current_triple",
36     "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
37     "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
38     "TARGET_TRIPLE=$llvm_target_triple",
39     "Python3_EXECUTABLE=$python_path",
40   ]
42   if (clangd_build_xpc) {
43     extra_values += [ "CLANGD_BUILD_XPC=1" ]
44   } else {
45     extra_values += [ "CLANGD_BUILD_XPC=0" ]
46   }
48   if (llvm_enable_zlib) {
49     extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
50   } else {
51     extra_values += [ "LLVM_ENABLE_ZLIB=0" ]
52   }
55 write_lit_config("lit_unit_site_cfg") {
56   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
57   input = "//clang-tools-extra/clangd/unittests/lit.site.cfg.py.in"
58   output = clangd_lit_unit_site_cfg_file
59   extra_values = [
60     "CMAKE_CURRENT_BINARY_DIR=" +
61         rebase_path(get_label_info("//clang-tools-extra/clangd/unittests",
62                                    "target_out_dir")),
63     "CMAKE_CURRENT_SOURCE_DIR=" +
64         rebase_path("//clang-tools-extra/clangd/unittests"),
65   ]
66   if (host_os == "win") {
67     # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
68     extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
69   } else {
70     extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
71   }
74 # This target should contain all dependencies of check-clangd.
75 # //:default depends on it, so that ninja's default target builds all
76 # prerequisites for check-clang but doesn't run check-clang itself.
77 group("test") {
78   deps = [
79     ":lit_site_cfg",
80     ":lit_unit_site_cfg",
81     "//clang-tools-extra/clangd/index/dex/dexp",
82     "//clang-tools-extra/clangd/indexer:clangd-indexer",
83     "//clang-tools-extra/clangd/tool:clangd",
84     "//clang-tools-extra/clangd/unittests:ClangdTests",
85     "//llvm/utils/FileCheck",
86     "//llvm/utils/llvm-lit",
87     "//llvm/utils/not",
88   ]
89   if (clangd_build_xpc) {
90     deps += [
91       "//clang-tools-extra/clangd/unittests/xpc:ClangdXpcTests",
92       "//clang-tools-extra/clangd/xpc/test-client:clangd-xpc-test-client",
93     ]
94   }
95   testonly = true
98 action("check-clangd") {
99   script = "$root_out_dir/bin/llvm-lit"
100   if (host_os == "win") {
101     script += ".py"
102   }
103   args = [
104     "-sv",
106     # clangd doesn't put unittest configs in test/unit like every other project.
107     # Because of that, this needs to pass two folders here, while every other
108     # project only needs to pass CMAKE_CURRENT_BINARY_DIR.
109     rebase_path(get_path_info(clangd_lit_site_cfg_file, "dir"), root_out_dir),
110     rebase_path(get_path_info(clangd_lit_unit_site_cfg_file, "dir"),
111                 root_out_dir),
112   ]
113   outputs = [ "$target_gen_dir/run-lit" ]  # Non-existing, so that ninja runs it
114                                            # each time.
116   # Since check-clangd is always dirty, //:default doesn't depend on it so
117   # that it's not part of the default ninja target.  Hence, check-clangd
118   # shouldn't have any deps except :test. so that the default target is sure to
119   # build all the deps.
120   deps = [ ":test" ]
121   testonly = true
123   pool = "//:console"