mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 04:46:45 +00:00
fix(rocks): if installing with luarocks (binaries) fails, then build from source. Fixes #1563
This commit is contained in:
parent
e02c5b1b57
commit
82276321f5
2 changed files with 35 additions and 2 deletions
|
@ -101,6 +101,7 @@ function M.check(opts)
|
|||
return ok
|
||||
end
|
||||
|
||||
---@async
|
||||
---@param task LazyTask
|
||||
function M.build(task)
|
||||
if
|
||||
|
@ -163,7 +164,7 @@ function M.build(task)
|
|||
)
|
||||
|
||||
local root = Config.options.rocks.root .. "/" .. task.plugin.name
|
||||
task:spawn(luarocks, {
|
||||
local ok = task:spawn(luarocks, {
|
||||
args = {
|
||||
"--tree",
|
||||
root,
|
||||
|
@ -181,6 +182,30 @@ function M.build(task)
|
|||
cwd = task.plugin.dir,
|
||||
env = env,
|
||||
})
|
||||
|
||||
if ok then
|
||||
return
|
||||
end
|
||||
|
||||
task:warn("Failed installing " .. rockspec.package .. " with `luarocks`.\nTrying to build from source.")
|
||||
|
||||
-- install failed, so try building from source
|
||||
task:set_level() -- reset level
|
||||
task:spawn(luarocks, {
|
||||
args = {
|
||||
"--tree",
|
||||
root,
|
||||
"--dev",
|
||||
"--lua-version",
|
||||
"5.1",
|
||||
"make",
|
||||
"--force-fast",
|
||||
"--deps-mode",
|
||||
"one",
|
||||
},
|
||||
cwd = task.plugin.dir,
|
||||
env = env,
|
||||
})
|
||||
end
|
||||
|
||||
---@param rockspec RockSpec
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue