xref: /llvm-project/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel (revision 3edd21ba6e35e981f3a91b71358eb41cdbab12da)
1# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2# See https://llvm.org/LICENSE.txt for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5package(
6    default_visibility = ["//visibility:public"],
7    features = ["layering_check"],
8)
9
10licenses(["notice"])
11
12# TODO: this is a shim to provide Features.inc as needed by Feature.h.
13# Replace this with something that parses Features.inc.in.
14genrule(
15    name = "gen_features_inc",
16    outs = ["Features.inc"],
17    cmd = "\n".join([
18        "echo '// IWYU pragma: private, include \"Feature.h\"' >> $@",
19        "echo '#define CLANGD_BUILD_XPC 0' >> $@",
20        "echo '#define CLANGD_ENABLE_REMOTE 1' >> $@",
21        "echo '#define ENABLE_GRPC_REFLECTION 0' >> $@",
22        "echo '#define CLANGD_MALLOC_TRIM 0' >> $@",
23        "echo '#define CLANGD_TIDY_CHECKS 1' >> $@",
24        "echo '#define CLANGD_DECISION_FOREST 1' >> $@",
25    ]),
26)
27
28# TODO: Pick up other files for more complete functionality, to match
29# clangd/CMakeLists.txt. This might look something like
30# glob(["*.cpp", "dir/**/*.cpp", ...]).
31cc_library(
32    name = "ClangDaemon",
33    srcs = [
34        "Feature.cpp",
35        "Features.inc",
36        "JSONTransport.cpp",
37        "Protocol.cpp",
38        "URI.cpp",
39        "index/SymbolID.cpp",
40        "support/Cancellation.cpp",
41        "support/Context.cpp",
42        "support/Logger.cpp",
43        "support/MemoryTree.cpp",
44        "support/Shutdown.cpp",
45        "support/ThreadCrashReporter.cpp",
46        "support/Trace.cpp",
47    ],
48    hdrs = [
49        "Feature.h",
50        "LSPBinder.h",
51        "Protocol.h",
52        "Transport.h",
53        "URI.h",
54        "index/SymbolID.h",
55        "support/Cancellation.h",
56        "support/Context.h",
57        "support/Function.h",
58        "support/Logger.h",
59        "support/MemoryTree.h",
60        "support/Shutdown.h",
61        "support/ThreadCrashReporter.h",
62        "support/Trace.h",
63    ],
64    includes = ["."],
65    deps = [
66        "//clang:basic",
67        "//clang:index",
68        "//llvm:Support",
69        "//llvm:TargetParser",
70        "//llvm:config",
71    ],
72)
73