Skip to content

Commit

Permalink
feat(build): set vim.env.LAZY_BUILD_DIR to plugin dir before building
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 24, 2024
1 parent f8dd282 commit cc14add
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions lua/lazy/manage/task/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,32 @@ M.build = {

builders = builders or get_build_file(self.plugin)

if builders then
builders = type(builders) == "table" and builders or { builders }
---@cast builders (string|fun(LazyPlugin))[]
for _, build in ipairs(builders) do
if type(build) == "function" then
self:async(function()
build(self.plugin)
end)
elseif build == "rockspec" then
B.rockspec(self)
elseif build:sub(1, 1) == ":" then
B.cmd(self, build)
elseif build:match("%.lua$") then
local file = self.plugin.dir .. "/" .. build
local chunk, err = loadfile(file)
if not chunk or err then
error(err)
end
self:async(chunk)
else
B.shell(self, build)
if not builders then
return
end

vim.env.LAZY_BUILD_DIR = self.plugin.dir

builders = type(builders) == "table" and builders or { builders }
---@cast builders (string|fun(LazyPlugin))[]
for _, build in ipairs(builders) do
if type(build) == "function" then
self:async(function()
build(self.plugin)
end)
elseif build == "rockspec" then
B.rockspec(self)
elseif build:sub(1, 1) == ":" then
B.cmd(self, build)
elseif build:match("%.lua$") then
local file = self.plugin.dir .. "/" .. build
local chunk, err = loadfile(file)
if not chunk or err then
error(err)
end
self:async(chunk)
else
B.shell(self, build)
end
end
end,
Expand Down

0 comments on commit cc14add

Please sign in to comment.