diff --git a/utils/gn/build/sync_source_lists_from_cmake.py b/utils/gn/build/sync_source_lists_from_cmake.py index dac45b2ab57..a39072042e4 100755 --- a/utils/gn/build/sync_source_lists_from_cmake.py +++ b/utils/gn/build/sync_source_lists_from_cmake.py @@ -61,8 +61,7 @@ def sync_unittests(): # Matches e.g. |add_llvm_unittest_with_input_files|. unittest_re = re.compile(r'^add_\S+_unittest', re.MULTILINE) - # FIXME: Add 'clang-tools-extra'. - checked = [ 'clang', 'lld', 'llvm' ] + checked = [ 'clang', 'clang-tools-extra', 'lld', 'llvm' ] for c in checked: for root, _, _ in os.walk(os.path.join(c, 'unittests')): cmake_file = os.path.join(root, 'CMakeLists.txt') diff --git a/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn b/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn index 1d64e70ac4f..9fe6b278624 100644 --- a/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn +++ b/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn @@ -1,10 +1,6 @@ +import("//clang-tools-extra/clangd/xpc/enable.gni") import("//llvm/utils/gn/build/write_cmake_config.gni") -declare_args() { - # Whether to build clangd's XPC components. - clangd_build_xpc = false -} - write_cmake_config("features") { # FIXME: Try moving Features.inc.in to tools, seems like a better location. input = "../Features.inc.in" @@ -33,6 +29,12 @@ executable("clangd") { "//clang/lib/Tooling/Core", "//llvm/lib/Support", ] + if (clangd_build_xpc) { + deps += [ + "//clang-tools-extra/clangd/xpc:conversions", + "//clang-tools-extra/clangd/xpc:transport", + ] + } include_dirs = [ "..", @@ -43,8 +45,4 @@ executable("clangd") { sources = [ "ClangdMain.cpp", ] - - if (clangd_build_xpc) { - # FIXME: Depend on clangdXpcJsonConversions, clangdXpcTransport - } } diff --git a/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn b/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn new file mode 100644 index 00000000000..f8e11866639 --- /dev/null +++ b/utils/gn/secondary/clang-tools-extra/clangd/xpc/BUILD.gn @@ -0,0 +1,26 @@ +static_library("conversions") { + output_name = "clangdXpcJsonConversions" + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang-tools-extra/clangd", + "//llvm/lib/Support", + ] + include_dirs = [ ".." ] + sources = [ + "Conversion.cpp", + ] +} + +static_library("transport") { + output_name = "clangdXpcTransport" + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + ":conversions", + "//clang-tools-extra/clangd", + "//llvm/lib/Support", + ] + include_dirs = [ ".." ] + sources = [ + "XPCTransport.cpp", + ] +} diff --git a/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni b/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni new file mode 100644 index 00000000000..843badbadfe --- /dev/null +++ b/utils/gn/secondary/clang-tools-extra/clangd/xpc/enable.gni @@ -0,0 +1,4 @@ +declare_args() { + # Whether to build clangd's XPC components. + clangd_build_xpc = current_os == "mac" +} diff --git a/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn b/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn index 57daee58dbd..f2fab1ea5ad 100644 --- a/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn +++ b/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn @@ -1,3 +1,5 @@ +import("//clang-tools-extra/clangd/xpc/enable.gni") + group("unittests") { deps = [ "clang-apply-replacements:ClangApplyReplacementsTests", @@ -10,6 +12,8 @@ group("unittests") { "clang-tidy:ClangTidyTests", "clangd:ClangdTests", ] - # FIXME: dep on clangd/xpc:ClangdXpcTests once it exists + if (clangd_build_xpc) { + deps += [ "clangd/xpc:ClangdXpcTests" ] + } testonly = true } diff --git a/utils/gn/secondary/clang-tools-extra/unittests/clangd/xpc/BUILD.gn b/utils/gn/secondary/clang-tools-extra/unittests/clangd/xpc/BUILD.gn new file mode 100644 index 00000000000..2d20e167173 --- /dev/null +++ b/utils/gn/secondary/clang-tools-extra/unittests/clangd/xpc/BUILD.gn @@ -0,0 +1,15 @@ +import("//llvm/utils/unittest/unittest.gni") + +unittest("ClangdXpcTests") { + configs += [ "//llvm/utils/gn/build:clang_code" ] + deps = [ + "//clang-tools-extra/clangd", + "//clang-tools-extra/clangd/xpc:conversions", + "//llvm/lib/Support", + "//llvm/lib/Testing/Support", + ] + include_dirs = [ "//clang-tools-extra/clangd" ] + sources = [ + "ConversionTests.cpp", + ] +}