@@ -55,28 +55,25 @@ function M.action(selected_option)
55
55
name = " - C compiler" ,
56
56
strategy = { " orchestrator" ,
57
57
tasks = {{ " shell" , name = " - Run program → " .. entry_point ,
58
- cmd = output .. -- run
59
- " && echo " .. output .. -- echo
58
+ cmd = output .. -- run
59
+ " && echo " .. output .. -- echo
60
60
" && echo '" .. final_message .. " '"
61
61
},},},})
62
62
task :start ()
63
63
vim .cmd (" OverseerOpen" )
64
64
elseif selected_option == " option4" then
65
65
local entry_points
66
+ local task = {}
66
67
local tasks = {}
67
- local task
68
+ local executables = {}
68
69
69
70
-- if .solution file exists in working dir
70
71
local solution_file = utils .get_solution_file ()
71
72
if solution_file then
72
73
local config = utils .parse_solution_file (solution_file )
73
- local executable
74
74
75
75
for entry , variables in pairs (config ) do
76
- if variables .executable then
77
- executable = utils .os_path (variables .executable )
78
- goto continue
79
- end
76
+ if entry == " executables" then goto continue end
80
77
entry_point = utils .os_path (variables .entry_point )
81
78
files = utils .find_files_to_compile (entry_point , " *.c" )
82
79
output = utils .os_path (variables .output )
@@ -93,21 +90,23 @@ function M.action(selected_option)
93
90
:: continue::
94
91
end
95
92
96
- if executable then
97
- task = { " shell" , name = " - Run program → " .. executable ,
98
- cmd = executable .. -- run
99
- " && echo " .. executable .. -- echo
100
- " && echo '" .. final_message .. " '"
101
- }
102
- else
103
- task = {}
93
+ local solution_executables = config [" executables" ]
94
+ if solution_executables then
95
+ for entry , executable in pairs (solution_executables ) do
96
+ task = { " shell" , name = " - Run program → " .. executable ,
97
+ cmd = executable .. -- run
98
+ " && echo " .. executable .. -- echo
99
+ " && echo '" .. final_message .. " '"
100
+ }
101
+ table.insert (executables , task ) -- store all the executables we've created
102
+ end
104
103
end
105
104
106
105
task = overseer .new_task ({
107
106
name = " - C compiler" , strategy = { " orchestrator" ,
108
107
tasks = {
109
- tasks , -- Build all the programs in the solution in parallel
110
- task -- Then run the solution executable
108
+ tasks , -- Build all the programs in the solution in parallel
109
+ executables -- Then run the solution executable(s)
111
110
}}})
112
111
task :start ()
113
112
vim .cmd (" OverseerOpen" )
0 commit comments