Skip to content

Commit 96ff16b

Browse files
committed
fix(#27): changes in overseer.
1 parent ff31d13 commit 96ff16b

30 files changed

+516
-484
lines changed

lua/compiler/bau/cmake.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ function M.action(option)
2626
local task = overseer.new_task({
2727
name = "- CMake interpreter",
2828
strategy = { "orchestrator",
29-
tasks = {{ "shell", name = "- Run CMake → " .. option,
29+
tasks = {{ name = "- Run CMake → " .. option,
3030
cmd = "mkdir -p \"" .. build_dir .. "\"" ..
3131
" && " .. cmd_build .. -- Build to 'build' directory.
3232
" && " .. cmd_target .. -- Build target from the 'build' directory.
3333
" && echo '" .. cmd_build .. " && " .. cmd_target .. "'" .. -- echo
34-
" && echo \"" .. final_message .. "\""
34+
" && echo \"" .. final_message .. "\"",
35+
components = { "default_extended" }
3536
},},},})
3637
task:start()
37-
vim.cmd("OverseerOpen")
3838
end
3939

4040
return M

lua/compiler/bau/gradle.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ function M.action(option)
2828
local task = overseer.new_task({
2929
name = "- Gradle interpreter",
3030
strategy = { "orchestrator",
31-
tasks = {{ "shell", name = "- " .. filename .. "" .. cmd .. " " .. option .. build_type,
31+
tasks = {{ name = "- " .. filename .. "" .. cmd .. " " .. option .. build_type,
3232
cmd = cmd .. " " .. option .. build_type .. -- run
3333
" && echo " .. cmd .. " " .. option .. build_type .. -- echo
34-
" && echo \"" .. final_message .. "\""
34+
" && echo \"" .. final_message .. "\"",
35+
components = { "default_extended" }
3536
},},},})
3637
task:start()
37-
vim.cmd("OverseerOpen")
3838
end
3939

4040
return M

lua/compiler/bau/make.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ function M.action(option)
99
local task = overseer.new_task({
1010
name = "- Make interpreter",
1111
strategy = { "orchestrator",
12-
tasks = {{ "shell", name = "- Run makefile → make " .. option ,
12+
tasks = {{ name = "- Run makefile → make " .. option ,
1313
cmd = "make ".. option .. -- run
1414
" && echo make " .. option .. -- echo
15-
" && echo \"" .. final_message .. "\""
15+
" && echo \"" .. final_message .. "\"",
16+
components = { "default_extended" }
1617
},},},})
1718
task:start()
18-
vim.cmd("OverseerOpen")
1919
end
2020

2121
return M

lua/compiler/bau/meson.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ function M.action(option)
2828
local task = overseer.new_task({
2929
name = "- Meson interpreter",
3030
strategy = { "orchestrator",
31-
tasks = {{ "shell", name = "- Run Meson → " .. option,
31+
tasks = {{ name = "- Run Meson → " .. option,
3232
cmd = "mkdir -p \"" .. build_dir .. "\"" ..
3333
" && " .. cmd_setup .. -- Setup
3434
" && " .. cmd_build .. -- Build target from the 'build' directory.
3535
--" && " .. cmd_target .. -- Run target
3636
" && echo \"" .. cmd_setup .. " && " .. cmd_build .. "\"" .. -- echo
37-
" && echo \"" .. final_message .. "\""
37+
" && echo \"" .. final_message .. "\"",
38+
components = { "default_extended" }
3839
},},},})
3940
task:start()
40-
vim.cmd("OverseerOpen")
4141
end
4242

4343
return M

lua/compiler/bau/nodejs.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ function M.action(option)
1111
local task = overseer.new_task({
1212
name = "- Node.js package manager",
1313
strategy = { "orchestrator",
14-
tasks = {{ "shell", name = "- Run script → " .. option,
14+
tasks = {{ name = "- Run script → " .. option,
1515
cmd = option .. -- run script
1616
" && echo \"" .. option .. "\"" .. -- echo
17-
" && echo \"" .. final_message .. "\""
17+
" && echo \"" .. final_message .. "\"",
18+
components = { "default_extended" }
1819
},},},})
1920
task:start()
20-
vim.cmd("OverseerOpen")
2121
end
2222

2323
return M

lua/compiler/init.lua

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ M.setup = function(opts)
5757
overseer.run_action(task, "dispose")
5858
end
5959
end, { desc = "Dispose all tasks running in the compiler" })
60+
61+
-- define the component used by the tasks
62+
require("overseer").register_alias("default_extended", {
63+
"default",
64+
{ "open_output", on_start = true, on_complete = "never" },
65+
})
6066
end
6167

6268
return M

lua/compiler/languages/asm.lua

+33-27
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,33 @@ function M.action(selected_option)
2929
local filename = vim.fn.fnamemodify(file, ":t")
3030
local output_o = output_dir .. filename .. ".o"
3131
file = utils.os_path(file, true)
32-
local task = { "shell", name = "- Build program → " .. file,
32+
local task = { name = "- Build program → " .. file,
3333
cmd = "rm -f \"" .. output .. "\" || true" .. -- clean
3434
" && mkdir -p \"" .. output_dir .. "\"" .. -- mkdir
3535
" && nasm -f elf64 " .. file .. " -o \"" .. output_o .. "\" ".. arguments .. -- compile
3636
" && echo " .. file .. -- echo
37-
" && echo \"" .. final_message .. "\""
37+
" && echo \"" .. final_message .. "\"",
38+
components = { "default_extended" }
3839
}
3940
files[_] = utils.os_path(output_dir .. filename .. ".o", true) -- prepare for linker
4041
table.insert(tasks_compile, task)
4142
end
4243
-- Link .o files
4344
files = table.concat(files ," ") -- table to string
44-
local task_link = { "shell", name = "- Link program → \"" .. entry_point .."\"" ,
45+
local task_link = { name = "- Link program → \"" .. entry_point .."\"" ,
4546
cmd = "ld " .. files .. " -o \"" .. output .. "\"" .. -- link
4647
" && rm -f " .. files .. " || true" .. -- clean
4748
" && \"" .. output .. "\"" .. -- run
4849
" && echo && echo \"" .. entry_point .. "\"" .. -- echo
49-
" && echo \"" .. final_message .. "\""
50+
" && echo \"" .. final_message .. "\"",
51+
components = { "default_extended" }
5052
}
5153
-- Run program
52-
local task_run = { "shell", name = "- Run program → \"" .. output .. "\"",
54+
local task_run = { name = "- Run program → \"" .. output .. "\"",
5355
cmd = utils.os_path(output, true) .. -- run
5456
" && echo && echo \"" .. output .. "\"" .. -- echo
55-
" && echo \"" .. final_message .. "\""
57+
" && echo \"" .. final_message .. "\"",
58+
components = { "default_extended" }
5659
}
5760
-- Runs tasks in order
5861
local task = overseer.new_task({
@@ -63,7 +66,6 @@ function M.action(selected_option)
6366
task_run -- Run program
6467
}}})
6568
task:start()
66-
vim.cmd("OverseerOpen")
6769

6870
elseif selected_option == "option2" then
6971
-- Build .asm files in parallel
@@ -72,23 +74,25 @@ function M.action(selected_option)
7274
local filename = vim.fn.fnamemodify(file, ":t")
7375
local output_o = output_dir .. filename .. ".o"
7476
file = utils.os_path(file, true)
75-
local task = { "shell", name = "- Build program → " .. file,
77+
local task = { name = "- Build program → " .. file,
7678
cmd = "rm -f \"" .. output .. "\" || true" .. -- clean
7779
" && mkdir -p \"" .. output_dir .. "\"" .. -- mkdir
7880
" && nasm -f elf64 " .. file .. " -o \"" .. output_o .. "\" " .. arguments .. -- compile
7981
" && echo " .. file .. -- echo
80-
" && echo \"" .. final_message .. "\""
82+
" && echo \"" .. final_message .. "\"",
83+
components = { "default_extended" }
8184
}
8285
files[_] = utils.os_path(output_dir .. filename .. ".o", true) -- prepare for linker
8386
table.insert(tasks_compile, task)
8487
end
8588
-- Link .o files
8689
files = table.concat(files ," ") -- table to string
87-
local task_link = { "shell", name = "- Link program → \"" .. entry_point .. "\"",
90+
local task_link = { name = "- Link program → \"" .. entry_point .. "\"",
8891
cmd = "ld " .. files .. " -o \"" .. output .. "\"" .. -- link
8992
" && rm -f " .. files .. " || true" .. -- clean
9093
" && echo \"" .. entry_point .. "\"" .. -- echo
91-
" && echo \"" .. final_message .. "\""
94+
" && echo \"" .. final_message .. "\"",
95+
components = { "default_extended" }
9296
}
9397
-- Runs tasks in order
9498
local task = overseer.new_task({
@@ -98,18 +102,17 @@ function M.action(selected_option)
98102
task_link, -- Link .o files
99103
}}})
100104
task:start()
101-
vim.cmd("OverseerOpen")
102105
elseif selected_option == "option3" then
103106
local task = overseer.new_task({
104107
name = "- Assembly compiler",
105108
strategy = { "orchestrator",
106-
tasks = {{ "shell", name = "- Run program → \"" .. output .. "\"",
109+
tasks = {{ name = "- Run program → \"" .. output .. "\"",
107110
cmd = "\"" .. output .. "\"" .. -- run
108111
" && echo && echo \"" .. output .. "\"" .. -- echo
109-
" && echo \"" .. final_message .. "\""
112+
" && echo \"" .. final_message .. "\"",
113+
components = { "default_extended" }
110114
},},},})
111115
task:start()
112-
vim.cmd("OverseerOpen")
113116
elseif selected_option == "option4" then
114117
local entry_points
115118
local task = {}
@@ -136,23 +139,25 @@ function M.action(selected_option)
136139
local filename = vim.fn.fnamemodify(file, ":t")
137140
local output_o = output_dir .. filename .. ".o"
138141
file = utils.os_path(file, true)
139-
local task = { "shell", name = "- Build program → " .. file,
142+
local task = { name = "- Build program → " .. file,
140143
cmd = "rm -f \"" .. output .. "\" || true" .. -- clean
141144
" && mkdir -p \"" .. output_dir .. "\"" .. -- mkdir
142145
" && nasm -f elf64 " .. file .. " -o \"" .. output_o .. "\" " .. arguments .. -- compile
143146
" && echo " .. file .. -- echo
144-
" && echo \"" .. final_message .. "\""
147+
" && echo \"" .. final_message .. "\"",
148+
components = { "default_extended" }
145149
}
146150
files[_] = utils.os_path(output_dir .. filename .. ".o", true) -- prepare for linker
147151
table.insert(tasks_compile, task)
148152
end
149153
-- Link .o files
150154
files = table.concat(files ," ") -- table to string
151-
local task_link = { "shell", name = "- Link program → " .. entry_point,
155+
local task_link = { name = "- Link program → " .. entry_point,
152156
cmd = "ld " .. files .. " -o \"" .. output .. "\"" .. -- link
153157
" && rm -f " .. files .. " || true" .. -- clean
154158
" && echo \"" .. entry_point .. "\"" .. -- echo
155-
" && echo \"" .. final_message .. "\""
159+
" && echo \"" .. final_message .. "\"",
160+
components = { "default_extended" }
156161
}
157162
table.insert(tasks, tasks_compile) -- store all the tasks we've created
158163
table.insert(tasks, task_link)
@@ -163,10 +168,11 @@ function M.action(selected_option)
163168
if solution_executables then
164169
for entry, executable in pairs(solution_executables) do
165170
utils.os_path(executable, true)
166-
task = { "shell", name = "- Run program → " .. executable,
171+
task = { name = "- Run program → " .. executable,
167172
cmd = executable .. -- run
168173
" && echo && echo " .. executable .. -- echo
169-
" && echo \"" .. final_message .. "\""
174+
" && echo \"" .. final_message .. "\"",
175+
components = { "default_extended" }
170176
}
171177
table.insert(executables, task) -- store all the executables we've created
172178
table.insert(tasks, executables)
@@ -180,7 +186,6 @@ function M.action(selected_option)
180186
-- -- Then run the solution executable(s)
181187
}})
182188
task:start()
183-
vim.cmd("OverseerOpen")
184189

185190
else -- If no .solution file
186191
-- Create a list of all entry point files in the working directory
@@ -200,23 +205,25 @@ function M.action(selected_option)
200205
local filename = vim.fn.fnamemodify(file, ":t")
201206
local output_o = output_dir .. filename .. ".o"
202207
file = utils.os_path(file, true)
203-
local task = { "shell", name = "- Build program → " .. file,
208+
local task = { name = "- Build program → " .. file,
204209
cmd = "rm -f \"" .. output .. "\" || true" .. -- clean
205210
" && mkdir -p \"" .. output_dir .. "\"" .. -- mkdir
206211
" && nasm -f elf64 " .. file .. " -o \"" .. output_o .. "\" " .. arguments .. -- compile
207212
" && echo " .. file .. -- echo
208-
" && echo \"" .. final_message .. "\""
213+
" && echo \"" .. final_message .. "\"",
214+
components = { "default_extended" }
209215
}
210216
files[_] = utils.os_path(output_dir .. filename .. ".o", true) -- prepare for linker
211217
table.insert(tasks_compile, task)
212218
end
213219
-- Link .o files
214220
files = table.concat(files ," ") -- table to string
215-
local task_link = { "shell", name = "- Link program → \"" .. entry_point .. "\"",
221+
local task_link = { name = "- Link program → \"" .. entry_point .. "\"",
216222
cmd = "ld " .. files .. " -o \"" .. output .. "\"" .. -- link
217223
" && rm -f " .. files .. " || true" .. -- clean
218224
" && echo \"" .. entry_point .. "\"" .. -- echo
219-
" && echo \"" .. final_message .. "\""
225+
" && echo \"" .. final_message .. "\"",
226+
components = { "default_extended" }
220227
}
221228
table.insert(tasks, tasks_compile) -- store all the tasks we've created
222229
table.insert(tasks, task_link)
@@ -227,7 +234,6 @@ function M.action(selected_option)
227234
tasks = tasks
228235
}})
229236
task:start()
230-
vim.cmd("OverseerOpen")
231237
end
232238
end
233239
end

0 commit comments

Comments
 (0)