@@ -78,43 +78,41 @@ function M.check(opts)
78
78
else
79
79
ok = Health .have (M .python , opts )
80
80
ok = Health .have (M .hererocks .bin (" luarocks" )) and ok
81
- ok = Health .have (
81
+ Health .have (
82
82
M .hererocks .bin (" lua" ),
83
83
vim .tbl_extend (" force" , opts , {
84
84
version = " -v" ,
85
85
version_pattern = " 5.1" ,
86
86
})
87
- ) and ok
87
+ )
88
88
end
89
89
else
90
90
ok = Health .have (" luarocks" , opts )
91
- ok = (
92
- Health .have (
93
- { " lua5.1" , " lua" , " lua-5.1" },
94
- vim .tbl_extend (" force" , opts , {
95
- version = " -v" ,
96
- version_pattern = " 5.1" ,
97
- })
98
- )
99
- ) and ok
91
+ Health .have (
92
+ { " lua5.1" , " lua" , " lua-5.1" },
93
+ vim .tbl_extend (" force" , opts , {
94
+ version = " -v" ,
95
+ version_pattern = " 5.1" ,
96
+ })
97
+ )
100
98
end
101
99
return ok
102
100
end
103
101
104
102
--- @async
105
103
--- @param task LazyTask
106
104
function M .build (task )
107
- if
108
- not M . check ({
109
- error = function (msg )
110
- task : error ( msg : gsub ( " [{}] " , " ` " ))
111
- end ,
112
- warn = function (msg )
113
- task : warn ( msg )
114
- end ,
115
- ok = function ( msg ) end ,
116
- })
117
- then
105
+ M . check ({
106
+ error = function ( msg )
107
+ task : error (msg : gsub ( " [{}] " , " ` " ) )
108
+ end ,
109
+ warn = function ( msg )
110
+ task : warn (msg )
111
+ end ,
112
+ ok = function ( msg ) end ,
113
+ })
114
+
115
+ if task : has_warnings () then
118
116
task :log ({
119
117
" " ,
120
118
" This plugin requires `luarocks`. Try one of the following:" ,
@@ -123,7 +121,11 @@ function M.build(task)
123
121
or " - enable `hererocks` with `opts.rocks.hererocks = true`" ,
124
122
" - disable `luarocks` support completely with `opts.rocks.enabled = false`" ,
125
123
})
126
- return
124
+ task :warn (" \n Will try building anyway, but will likely fail..." )
125
+
126
+ task :warn (" \n " .. string.rep (" -" , 80 ) .. " \n " )
127
+
128
+ task :set_level (vim .log .levels .WARN )
127
129
end
128
130
129
131
if task .plugin .name == " hererocks" then
@@ -187,11 +189,13 @@ function M.build(task)
187
189
return
188
190
end
189
191
190
- task :warn (" Failed installing " .. rockspec .package .. " with `luarocks`.\n Trying to build from source." )
192
+ task :warn (" Failed installing " .. rockspec .package .. " with `luarocks`." )
193
+ task :warn (" \n " .. string.rep (" -" , 80 ) .. " \n " )
194
+ task :warn (" Trying to build from source." )
191
195
192
196
-- install failed, so try building from source
193
197
task :set_level () -- reset level
194
- task :spawn (luarocks , {
198
+ ok = task :spawn (luarocks , {
195
199
args = {
196
200
" --tree" ,
197
201
root ,
@@ -206,6 +210,9 @@ function M.build(task)
206
210
cwd = task .plugin .dir ,
207
211
env = env ,
208
212
})
213
+ if not ok then
214
+ require (" lazy.manage.task.fs" ).clean .run (task , { rocks_only = true })
215
+ end
209
216
end
210
217
211
218
--- @param rockspec RockSpec
0 commit comments