fix(build): only load the plugin before build for `:` build commands

This commit is contained in:
Folke Lemaitre 2024-07-19 08:57:35 +02:00
parent c92c6b5fd2
commit 5bdb12a038
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 3 additions and 4 deletions

View File

@ -19,6 +19,9 @@ local B = {}
---@param task LazyTask
---@param build string
function B.cmd(task, build)
if task.plugin.build ~= "rockspec" then
Loader.load(task.plugin, { task = "build" })
end
local cmd = vim.api.nvim_parse_cmd(build:sub(2), {}) --[[@as vim.api.keyset.cmd]]
task:log(vim.api.nvim_cmd(cmd, { output = true }))
end
@ -48,10 +51,6 @@ M.build = {
run = function(self)
vim.cmd([[silent! runtime plugin/rplugin.vim]])
if self.plugin.build ~= "rockspec" then
Loader.load(self.plugin, { task = "build" })
end
local builders = self.plugin.build
-- Skip if `build` is set to `false`