File tree 1 file changed +25
-1
lines changed
1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -4,20 +4,44 @@ local Loader = require("lazy.core.loader")
4
4
--- @type table<string , LazyTaskDef>
5
5
local M = {}
6
6
7
+ --- @param plugin LazyPlugin
8
+ local function get_build_file (plugin )
9
+ for _ , path in ipairs ({ " build.lua" , " build/init.lua" }) do
10
+ path = plugin .dir .. " /" .. path
11
+ if Util .file_exists (path ) then
12
+ return path
13
+ end
14
+ end
15
+ end
16
+
7
17
M .build = {
8
18
--- @param opts ? { force : boolean }
9
19
skip = function (plugin , opts )
10
20
if opts and opts .force then
11
21
return false
12
22
end
13
- return not (plugin ._ .dirty and plugin .build )
23
+ return not (plugin ._ .dirty and ( plugin .build or get_build_file ( plugin )) )
14
24
end ,
15
25
run = function (self )
16
26
vim .cmd ([[ silent! runtime plugin/rplugin.vim]] )
17
27
18
28
Loader .load (self .plugin , { task = " build" })
19
29
20
30
local builders = self .plugin .build
31
+
32
+ local build_file = get_build_file (self .plugin )
33
+ if build_file then
34
+ if builders then
35
+ Util .warn (
36
+ (" Plugin **%s** provides its own build script.\n Please remove the `build` option from the plugin's spec" ):format (
37
+ self .plugin .name
38
+ )
39
+ )
40
+ end
41
+ builders = function ()
42
+ Loader .source (build_file )
43
+ end
44
+ end
21
45
if builders then
22
46
builders = type (builders ) == " table" and builders or { builders }
23
47
--- @cast builders (string | fun ( LazyPlugin )) []
You can’t perform that action at this time.
0 commit comments