Skip to content

Commit

Permalink
fix: don't hardcode wrapper script executable paths
Browse files Browse the repository at this point in the history
Fixes #22.
  • Loading branch information
williamboman committed Jul 8, 2022
1 parent 8c0c47b commit 31a2355
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 22 deletions.
6 changes: 4 additions & 2 deletions lua/mason/packages/chrome-debug-adapter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ return Pkg.new {
ctx.fs:rmrf "images"
ctx.fs:rmrf "testdata"
ctx.fs:rmrf ".git"
ctx:write_node_exec_wrapper("chrome-debug-adapter", path.concat { "out", "src", "chromeDebug.js" })
ctx:link_bin("chrome-debug-adapter", "chrome-debug-adapter")
ctx:link_bin(
"chrome-debug-adapter",
ctx:write_node_exec_wrapper("chrome-debug-adapter", path.concat { "out", "src", "chromeDebug.js" })
)
end,
}
6 changes: 4 additions & 2 deletions lua/mason/packages/firefox-debug-adapter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ return Pkg.new {
ctx.spawn.npm { "install" }
ctx.spawn.npm { "run", "build" }
ctx.spawn.npm { "install", "--production" }
ctx:write_node_exec_wrapper("firefox-debug-adapter", path.concat { "dist", "adapter.bundle.js" })
ctx:link_bin("firefox-debug-adapter", "firefox-debug-adapter")
ctx:link_bin(
"firefox-debug-adapter",
ctx:write_node_exec_wrapper("firefox-debug-adapter", path.concat { "dist", "adapter.bundle.js" })
)
end,
}
8 changes: 6 additions & 2 deletions lua/mason/packages/go-debug-adapter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local Pkg = require "mason.core.package"
local github = require "mason.core.managers.github"
local _ = require "mason.core.functional"
local path = require "mason.core.path"
local platform = require "mason.core.platform"

return Pkg.new {
name = "go-debug-adapter",
Expand All @@ -18,7 +19,10 @@ return Pkg.new {
asset_file = _.compose(_.format "go-%s.vsix", _.gsub("^v", "")),
})
.with_receipt()
ctx:write_node_exec_wrapper("go-debug-adapter", path.concat { "extension", "dist", "debugAdapter.js" })
ctx:link_bin("go-debug-adapter", "go-debug-adapter")

ctx:link_bin(
"go-debug-adapter",
ctx:write_node_exec_wrapper("go-debug-adapter", path.concat { "extension", "dist", "debugAdapter.js" })
)
end,
}
8 changes: 5 additions & 3 deletions lua/mason/packages/ktlint/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ return Pkg.new {
ctx:link_bin("ktlint", "ktlint")
end,
win = function()
ctx:write_shell_exec_wrapper(
ctx:link_bin(
"ktlint",
("java -jar %q"):format(path.concat { ctx.package:get_install_path(), "ktlint" })
ctx:write_shell_exec_wrapper(
"ktlint",
("java -jar %q"):format(path.concat { ctx.package:get_install_path(), "ktlint" })
)
)
ctx:link_bin("ktlint", "ktlint.cmd")
end,
}
end,
Expand Down
16 changes: 9 additions & 7 deletions lua/mason/packages/lua-language-server/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,18 @@ return Pkg.new {

platform.when {
unix = function()
ctx:write_exec_wrapper(
ctx:link_bin(
"lua-language-server",
path.concat {
"extension",
"server",
"bin",
ctx:write_exec_wrapper(
"lua-language-server",
}
path.concat {
"extension",
"server",
"bin",
"lua-language-server",
}
)
)
ctx:link_bin("lua-language-server", "lua-language-server")
end,
win = function()
ctx:link_bin(
Expand Down
3 changes: 1 addition & 2 deletions lua/mason/packages/netcoredbg/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ return Pkg.new {
})
.with_receipt()
ctx.fs:rename("netcoredbg", "build")
ctx:write_exec_wrapper("netcoredbg", path.concat { "build", "netcoredbg" })
ctx:link_bin("netcoredbg", "netcoredbg")
ctx:link_bin("netcoredbg", ctx:write_exec_wrapper("netcoredbg", path.concat { "build", "netcoredbg" }))
end,
win = function()
github
Expand Down
6 changes: 4 additions & 2 deletions lua/mason/packages/node-debug2-adapter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ return Pkg.new {
ctx.spawn.npm { "install" }
ctx.spawn.npm { "run", "build" }
ctx.spawn.npm { "install", "--production" }
ctx:write_node_exec_wrapper("node-debug2-adapter", path.concat { "out", "src", "nodeDebug.js" })
ctx:link_bin("node-debug2-adapter", "node-debug2-adapter")
ctx:link_bin(
"node-debug2-adapter",
ctx:write_node_exec_wrapper("node-debug2-adapter", path.concat { "out", "src", "nodeDebug.js" })
)
end,
}
6 changes: 4 additions & 2 deletions lua/mason/packages/php-debug-adapter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ return Pkg.new {
})
.with_receipt()
ctx.fs:rmrf(path.concat { "extension", "images" })
ctx:write_node_exec_wrapper("php-debug-adapter", path.concat { "extension", "out", "phpDebug.js" })
ctx:link_bin("php-debug-adapter", "php-debug-adapter")
ctx:link_bin(
"php-debug-adapter",
ctx:write_node_exec_wrapper("php-debug-adapter", path.concat { "extension", "out", "phpDebug.js" })
)
end,
}

0 comments on commit 31a2355

Please sign in to comment.