aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core
diff options
context:
space:
mode:
Diffstat (limited to 'lua/mason-core')
-rw-r--r--lua/mason-core/installer/context.lua7
-rw-r--r--lua/mason-core/installer/linker.lua3
2 files changed, 8 insertions, 2 deletions
diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua
index 7d0a505b..50850219 100644
--- a/lua/mason-core/installer/context.lua
+++ b/lua/mason-core/installer/context.lua
@@ -141,6 +141,7 @@ end
---@field public package Package
---@field public cwd CwdManager
---@field public stdio_sink StdioSink
+---@field private bin_links table<string, string>
local InstallContext = {}
InstallContext.__index = InstallContext
@@ -160,6 +161,7 @@ function InstallContext.new(handle, opts)
receipt = receipt.InstallReceiptBuilder.new(),
requested_version = Optional.of_nilable(opts.requested_version),
stdio_sink = handle.stdio.sink,
+ bin_links = {},
}, InstallContext)
end
@@ -310,8 +312,11 @@ function InstallContext:write_shell_exec_wrapper(new_executable_rel_path, comman
}
end
+---@param executable string
+---@param rel_path string
function InstallContext:link_bin(executable, rel_path)
- self.receipt:with_link("bin", executable, rel_path)
+ self.bin_links[executable] = rel_path
+ return self
end
return InstallContext
diff --git a/lua/mason-core/installer/linker.lua b/lua/mason-core/installer/linker.lua
index 0419f392..a1cc53d0 100644
--- a/lua/mason-core/installer/linker.lua
+++ b/lua/mason-core/installer/linker.lua
@@ -33,7 +33,7 @@ end
---@async
---@param context InstallContext
local function link_bin(context)
- local links = context.receipt.links.bin
+ local links = context.bin_links
local pkg = context.package
for name, rel_path in pairs(links) do
local target_abs_path = path.concat { pkg:get_install_path(), rel_path }
@@ -71,6 +71,7 @@ local function link_bin(context)
)
end,
}
+ context.receipt:with_link("bin", name, rel_path)
end
end