aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-28 16:21:09 +0200
committerWilliam Boman <william@redwill.se>2022-05-28 16:23:01 +0200
commit9141422b64e8038b8111a293c9f6259112ef7e7e (patch)
tree5fee089b88c8de56b9deaccd47341716f7168442 /lua
parentrefactor(solang): don't download llvm (#729) (diff)
downloadmason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar.gz
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar.bz2
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar.lz
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar.xz
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.tar.zst
mason-9141422b64e8038b8111a293c9f6259112ef7e7e.zip
Revert "refactor(solang): don't download llvm (#729)"
This reverts commit e65ef77e6cc12c68b28b5fe65758e6d09d64b96d. This is reverted because solang actually requires a patched version of llvm.
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/servers/solang/init.lua64
1 files changed, 48 insertions, 16 deletions
diff --git a/lua/nvim-lsp-installer/servers/solang/init.lua b/lua/nvim-lsp-installer/servers/solang/init.lua
index 77d8783b..877dc86e 100644
--- a/lua/nvim-lsp-installer/servers/solang/init.lua
+++ b/lua/nvim-lsp-installer/servers/solang/init.lua
@@ -1,4 +1,5 @@
local server = require "nvim-lsp-installer.server"
+local path = require "nvim-lsp-installer.core.path"
local functional = require "nvim-lsp-installer.core.functional"
local platform = require "nvim-lsp-installer.core.platform"
local process = require "nvim-lsp-installer.core.process"
@@ -8,30 +9,61 @@ local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = functional.coalesce, functional.when
return function(name, root_dir)
+ ---@async
+ local function download_solang()
+ local source = github.download_release_file({
+ repo = "hyperledger-labs/solang",
+ out_file = platform.is_win and "solang.exe" or "solang",
+ asset_file = coalesce(
+ when(platform.is_mac and platform.arch == "x64", "solang-mac-intel"),
+ when(platform.is_mac and platform.arch == "arm64", "solang-mac-arm"),
+ when(platform.is_linux and platform.arch == "arm64", "solang-linux-arm64"),
+ when(platform.is_linux and platform.arch == "x64", "solang-linux-x86-64"),
+ when(platform.is_win, "solang.exe")
+ ),
+ }).with_receipt()
+ std.chmod("+x", { "solang" })
+ return source
+ end
+
+ ---@async
+ ---Solang needs a build of llvm with some extra patches.
+ local function download_llvm()
+ local source = github.release_file {
+ repo = "hyperledger-labs/solang",
+ asset_file = coalesce(
+ when(platform.is_mac and platform.arch == "x64", "llvm13.0-mac-intel.tar.xz"),
+ when(platform.is_mac and platform.arch == "arm64", "llvm13.0-mac-arm.tar.xz"),
+ when(platform.is_linux and platform.arch == "x64", "llvm13.0-linux-x86-64.tar.xz"),
+ when(platform.is_linux and platform.arch == "arm64", "llvm13.0-linux-arm64.tar.xz"),
+ when(platform.is_win, "llvm13.0-win.zip")
+ ),
+ }
+ if platform.is_win then
+ std.download_file(source.download_url, "llvm.zip")
+ std.unzip("llvm.zip", ".")
+ else
+ std.download_file(source.download_url, "llvm.tar.xz")
+ std.untar "llvm.tar.xz"
+ end
+ end
+
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://solang.readthedocs.io/en/latest/",
languages = { "solidity" },
- ---@async
- installer = function()
- local source = github.download_release_file({
- repo = "hyperledger-labs/solang",
- out_file = platform.is.win and "solang.exe" or "solang",
- asset_file = coalesce(
- when(platform.is.mac_x64, "solang-mac-intel"),
- when(platform.is.mac_arm64, "solang-mac-arm"),
- when(platform.is.linux_arm64, "solang-linux-arm64"),
- when(platform.is.linux_x64, "solang-linux-x86-64"),
- when(platform.is.win_x64, "solang.exe")
- ),
- }).with_receipt()
- std.chmod("+x", { "solang" })
- return source
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ ctx:run_concurrently { download_solang, download_llvm }
end,
default_options = {
cmd_env = {
- PATH = process.extend_path { root_dir },
+ PATH = process.extend_path {
+ path.concat { root_dir },
+ path.concat { root_dir, "llvm13.0", "bin" },
+ path.concat { root_dir, "llvm12.0", "bin" }, -- kept for backwards compatibility
+ },
},
},
}