diff options
| author | William Boman <william@redwill.se> | 2022-07-06 19:41:43 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2022-07-07 00:39:59 +0200 |
| commit | 5f634e0c37e723fc0c33e06b4fd5c2180178db40 (patch) | |
| tree | fa4f09363adefa8259e23e4d1ea036db628b1243 /lua/nvim-lsp-installer/servers/ccls | |
| parent | feat(health): use stderr for java version, also check for JAVA_HOME (#765) (diff) | |
| download | mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.gz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.bz2 mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.lz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.xz mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.tar.zst mason-5f634e0c37e723fc0c33e06b4fd5c2180178db40.zip | |
mason.nvim
Diffstat (limited to 'lua/nvim-lsp-installer/servers/ccls')
| -rw-r--r-- | lua/nvim-lsp-installer/servers/ccls/common.lua | 41 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/ccls/init.lua | 24 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/ccls/linux.lua | 73 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/ccls/mac.lua | 22 |
4 files changed, 0 insertions, 160 deletions
diff --git a/lua/nvim-lsp-installer/servers/ccls/common.lua b/lua/nvim-lsp-installer/servers/ccls/common.lua deleted file mode 100644 index 666a2a6a..00000000 --- a/lua/nvim-lsp-installer/servers/ccls/common.lua +++ /dev/null @@ -1,41 +0,0 @@ -local path = require "nvim-lsp-installer.core.path" -local platform = require "nvim-lsp-installer.core.platform" -local installer = require "nvim-lsp-installer.core.installer" -local git = require "nvim-lsp-installer.core.managers.git" -local Optional = require "nvim-lsp-installer.core.optional" - ----@async ----@param opts {llvm_dir: string} -return function(opts) - local ctx = installer.context() - local clang_resource_dir = path.concat { ctx.destination_dir, "clang-resource" } - local install_prefix = ctx.cwd:get() - - ctx.fs:mkdir "ccls-git" - ctx:chdir("ccls-git", function() - git.clone { "https://github.com/MaskRay/ccls", recursive = true } - ctx.spawn.cmake { - "-DCMAKE_BUILD_TYPE=Release", - "-DUSE_SYSTEM_RAPIDJSON=OFF", - "-DCMAKE_FIND_FRAMEWORK=LAST", - "-Wno-dev", - ("-DCMAKE_INSTALL_PREFIX=%s"):format(install_prefix), - Optional.of_nilable(opts.llvm_dir) - :map(function(llvm_dir) - return { - ("-DCMAKE_PREFIX_PATH=%s"):format(llvm_dir), - -- On Mac we use Homebrew LLVM which will persist after installation. - -- On Linux, and when a custom llvm_dir is provided, its clang resource dir will be the only - -- artifact persisted after installation, as the locally installed llvm installation will be - -- cleaned up after compilation. - not platform.is_mac and ("-DCLANG_RESOURCE_DIR=%s"):format(clang_resource_dir) or vim.NIL, - } - end) - :or_else(vim.NIL), - platform.is_mac and "-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" or vim.NIL, - } - - ctx.spawn.make { "install" } - end) - ctx.fs:rmrf "ccls-git" -end diff --git a/lua/nvim-lsp-installer/servers/ccls/init.lua b/lua/nvim-lsp-installer/servers/ccls/init.lua deleted file mode 100644 index 4302e58e..00000000 --- a/lua/nvim-lsp-installer/servers/ccls/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -local server = require "nvim-lsp-installer.server" -local path = require "nvim-lsp-installer.core.path" -local platform = require "nvim-lsp-installer.core.platform" -local process = require "nvim-lsp-installer.core.process" - -return function(name, root_dir) - return server.Server:new { - name = name, - root_dir = root_dir, - homepage = "https://github.com/MaskRay/ccls", - languages = { "c", "c++", "objective-c" }, - installer = function() - platform.when { - mac = require "nvim-lsp-installer.servers.ccls.mac", - linux = require "nvim-lsp-installer.servers.ccls.linux", - } - end, - default_options = { - cmd_env = { - PATH = process.extend_path { path.concat { root_dir, "bin" } }, - }, - }, - } -end diff --git a/lua/nvim-lsp-installer/servers/ccls/linux.lua b/lua/nvim-lsp-installer/servers/ccls/linux.lua deleted file mode 100644 index 44bd29ca..00000000 --- a/lua/nvim-lsp-installer/servers/ccls/linux.lua +++ /dev/null @@ -1,73 +0,0 @@ -local path = require "nvim-lsp-installer.core.path" -local platform = require "nvim-lsp-installer.core.platform" -local installer = require "nvim-lsp-installer.core.installer" -local github = require "nvim-lsp-installer.core.managers.github" -local functional = require "nvim-lsp-installer.core.functional" -local Result = require "nvim-lsp-installer.core.result" -local Optional = require "nvim-lsp-installer.core.optional" - -local ccls_installer = require "nvim-lsp-installer.servers.ccls.common" - -local coalesce, when = functional.coalesce, functional.when - ----@param release string -local function normalize_llvm_release(release) - -- Strip the "llvmorg-" prefix from tags (llvm releases tags like llvmorg-13.0.0) - local normalized_release = release:gsub("^llvmorg%-", "") - return normalized_release -end - ----@async -local function llvm_installer() - local ctx = installer.context() - local os_dist = platform.os_distribution() - - local asset_name = coalesce( - when( - platform.arch == "x64", - coalesce( - when( - os_dist.id == "ubuntu" and os_dist.version.major >= 20, - "clang+llvm-%s-x86_64-linux-gnu-ubuntu-20.04" - ), - when( - os_dist.id == "ubuntu" and os_dist.version.major >= 16, - "clang+llvm-%s-x86_64-linux-gnu-ubuntu-16.04" - ) - ) - ), - when(platform.arch == "arm64", "clang+llvm-%s-aarch64-linux-gnu"), - when(platform.arch == "armv7", "clang+llvm-%s-armv7a-linux-gnueabihf") - ) - - local source = github.untarxz_release_file { - repo = "llvm/llvm-project", - version = Optional.of "llvmorg-13.0.0", - asset_file = function(release) - local normalized_release = normalize_llvm_release(release) - return asset_name and ("%s.tar.xz"):format(asset_name):format(normalized_release) - end, - } - - ctx.fs:rename(asset_name:format(normalize_llvm_release(source.release)), "llvm") - -- We move the clang headers out, because they need to be persisted - ctx.fs:rename(path.concat { "llvm", "lib", "clang", normalize_llvm_release(source.release) }, "clang-resource") - - return path.concat { ctx.cwd:get(), "llvm" } -end - ----@async -return function() - local ctx = installer.context() - Result.run_catching(llvm_installer) - :map(function(llvm_dir) - ccls_installer { llvm_dir = llvm_dir } - ctx.fs:rmrf "llvm" - end) - :recover(function() - pcall(function() - ctx.fs:rmrf "llvm" - end) - ccls_installer {} - end) -end diff --git a/lua/nvim-lsp-installer/servers/ccls/mac.lua b/lua/nvim-lsp-installer/servers/ccls/mac.lua deleted file mode 100644 index b9b482b7..00000000 --- a/lua/nvim-lsp-installer/servers/ccls/mac.lua +++ /dev/null @@ -1,22 +0,0 @@ -local path = require "nvim-lsp-installer.core.path" -local platform = require "nvim-lsp-installer.core.platform" -local installer = require "nvim-lsp-installer.core.installer" -local fs = require "nvim-lsp-installer.core.fs" - -local ccls_installer = require "nvim-lsp-installer.servers.ccls.common" - ----@async -return function() - local ctx = installer.context() - local homebrew_prefix = platform.get_homebrew_prefix():get_or_throw() - local llvm_dir = path.concat { homebrew_prefix, "opt", "llvm", "lib", "cmake" } - if not fs.async.dir_exists(llvm_dir) then - ctx.stdio_sink.stderr( - ( - "LLVM does not seem to be installed on this system (looked in %q). Please install LLVM via Homebrew:\n $ brew install llvm\n" - ):format(llvm_dir) - ) - error "Unable to find LLVM." - end - ccls_installer { llvm_dir = llvm_dir } -end |
