From e8530f4059279a0d6b5e5f8891d04ffb1ade29a3 Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 3 Jan 2022 15:12:53 +0100 Subject: write install receipts (#379) --- lua/nvim-lsp-installer/servers/solc/init.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'lua/nvim-lsp-installer/servers/solc/init.lua') diff --git a/lua/nvim-lsp-installer/servers/solc/init.lua b/lua/nvim-lsp-installer/servers/solc/init.lua index dd04f592..bdd2b331 100644 --- a/lua/nvim-lsp-installer/servers/solc/init.lua +++ b/lua/nvim-lsp-installer/servers/solc/init.lua @@ -9,28 +9,27 @@ local coalesce, when = Data.coalesce, Data.when return function(name, root_dir) local bin_name = platform.is_win and "solc.exe" or "solc" - return server.Server:new { name = name, root_dir = root_dir, homepage = "https://github.com/ethereum/solidity", languages = { "solidity" }, installer = { - context.capture(function(ctx) - local file_template = coalesce( - when(platform.is_mac, "macosx-amd64/solc-macosx-amd64-%s"), - when(platform.is_linux and platform.arch == "x64", "linux-amd64/solc-linux-amd64-%s"), - when(platform.is_win and platform.arch == "x64", "windows-amd64/solc-windows-amd64-%s.exe") + context.use_github_release_file( + "ethereum/solidity", + coalesce( + when(platform.is_mac, "solc-macos"), + when(platform.is_linux, "solc-static-linux"), + when(platform.is_win, "solc-windows.exe") ) - if not file_template then - error( - ("Current operating system and/or arch (%q) is currently not supported."):format(platform.arch) - ) - end - file_template = file_template:format(coalesce(ctx.requested_server_version, "latest")) - return std.download_file(("https://binaries.soliditylang.org/%s"):format(file_template), bin_name) + ), + context.capture(function(ctx) + return std.download_file(ctx.github_release_file, bin_name) end), std.chmod("+x", { bin_name }), + context.receipt(function(receipt, ctx) + receipt:with_primary_source(receipt.github_release_file(ctx)) + end), }, default_options = { cmd_env = { -- cgit v1.2.3-70-g09d2