Canviant namespaces jerarquic
[makerl.git] / src / execution.erl
blob26b891c1e71382f08a79eb24fde38ae7abaa0041
1 %%%-------------------------------------------------------------------
2 %%% File : execution.erl
3 %%% Author : <>
4 %%% Description :
5 %%%
6 %%% Created : 8 Apr 2011 by <>
7 %%%-------------------------------------------------------------------
8 -module(execution).
9 -include("makerl.hrl").
10 -export([execute/3]).
12 -spec execute(string(), [string()], options_type()) -> [build_result()].
13 execute(File, Targets, CmdLineOptions) ->
14 config_parser:parse_file(File, CmdLineOptions),
15 ok = check_unknown_targets(Targets),
16 [ task:build_target(T) || T <- Targets ]. %% Bind? Aggregated results?
18 -spec check_unknown_targets([string()]) -> ok.
19 check_unknown_targets(Targets) ->
20 NotFound = lists:filter(fun(T) ->
21 case task_registry:find_pid_by_target(T) of
22 {ok, _} -> false;
23 _ -> true
24 end
25 end,
26 Targets),
27 case NotFound of
28 [] -> ok;
29 L -> throw({error, {targets_unknown, L}})
30 end.