1 -module(mkrl_execution
).
2 -include("makerl.hrl").
7 -spec
spawn_tasks([term()], options_type()) -> any().
8 spawn_tasks(Tasks
, Opts
) ->
9 Ctx
= #eval_ctx
{ task_registry
= mkrl_task_registry:new(),
11 mkrl_script_eval:eval(
12 mkrl_script_expand:expand(Tasks
, Opts
),
16 -spec
execute(string(), [string()], options_type()) -> [build_result()].
17 execute(File
, Targets
, CmdLineOptions
) ->
18 Ctx
= spawn_tasks(mkrl_script_read:read(File
), CmdLineOptions
),
19 ok
= check_unknown_targets(Ctx#eval_ctx
.task_registry
, Targets
),
20 [ mkrl_task:build_target(Ctx#eval_ctx
.task_registry
, T
)
21 || T
<- Targets
]. %% Bind? Aggregated results?
23 -spec
check_unknown_targets(tid(), [string()]) -> ok
.
24 check_unknown_targets(TaskRegistry
, Targets
) ->
25 NotFound
= lists:filter(fun(T
) ->
26 case mkrl_task_registry:find_pid_by_target(TaskRegistry
, T
) of
34 L
-> throw({error
, {targets_unknown
, L
}})