1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
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"
local std = require "nvim-lsp-installer.core.managers.std"
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.release_file {
repo = "hyperledger-labs/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")
),
}
source.with_receipt()
std.download_file(source.download_url, platform.is_win and "solang.exe" or "solang")
std.chmod("+x", { "solang" })
return source
end
---@async
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" },
---@param ctx InstallContext
installer = function(ctx)
ctx:run_concurrently { download_solang, download_llvm }
end,
default_options = {
cmd_env = {
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
},
},
},
}
end
|