|
|
@ -19,10 +19,9 @@ |
|
|
|
|
|
|
|
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}. |
|
|
|
init(State) -> |
|
|
|
Jobs = ?DEFAULT_JOBS, |
|
|
|
JobsHelp = io_lib:format( |
|
|
|
"Number of concurrent workers a command may use. Default: ~B", |
|
|
|
[Jobs]), |
|
|
|
[?DEFAULT_JOBS]), |
|
|
|
State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, |
|
|
|
{module, ?MODULE}, |
|
|
|
{bare, false}, |
|
|
@ -37,16 +36,18 @@ init(State) -> |
|
|
|
|
|
|
|
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. |
|
|
|
do(State) -> |
|
|
|
ProjectApps = rebar_state:project_apps(State), |
|
|
|
Deps = rebar_state:get(State, deps_to_build, []), |
|
|
|
{ok, State1} = handle_args(State), |
|
|
|
|
|
|
|
ProjectApps = rebar_state:project_apps(State1), |
|
|
|
Deps = rebar_state:get(State1, deps_to_build, []), |
|
|
|
|
|
|
|
lists:foreach(fun(AppInfo) -> |
|
|
|
C = rebar_config:consult(rebar_app_info:dir(AppInfo)), |
|
|
|
S = rebar_state:new(rebar_state:new(), C, rebar_app_info:dir(AppInfo)), |
|
|
|
S = rebar_state:new(State1, C, rebar_app_info:dir(AppInfo)), |
|
|
|
build(S, AppInfo) |
|
|
|
end, Deps++ProjectApps), |
|
|
|
|
|
|
|
{ok, State}. |
|
|
|
{ok, State1}. |
|
|
|
|
|
|
|
build(State, AppInfo) -> |
|
|
|
?INFO("Compiling ~s~n", [rebar_app_info:name(AppInfo)]), |
|
|
@ -57,3 +58,8 @@ build(State, AppInfo) -> |
|
|
|
%% =================================================================== |
|
|
|
%% Internal functions |
|
|
|
%% =================================================================== |
|
|
|
|
|
|
|
handle_args(State) -> |
|
|
|
{Args, _} = rebar_state:command_parsed_args(State), |
|
|
|
Jobs = proplists:get_value(jobs, Args, ?DEFAULT_JOBS), |
|
|
|
{ok, rebar_state:set(State, jobs, Jobs)}. |