summaryrefslogtreecommitdiff
path: root/src/rebar_core.erl
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2009-12-01 20:34:18 -0700
committerDave Smith <dizzyd@dizzyd.com>2009-12-01 20:34:18 -0700
commit3765b866533aed496d2fcf3fd1a8192ebe4283a8 (patch)
tree4fdf86ffcb4e835df8b7e80d8125f6e14a5ca5bc /src/rebar_core.erl
parentd885b1c04cae87dbaf0c210885ca7768dfae67ca (diff)
Adding support for subdirs
Diffstat (limited to 'src/rebar_core.erl')
-rw-r--r--src/rebar_core.erl25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index 926303d..9911626 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -162,7 +162,7 @@ apply_commands(Targets, [CommandStr | Rest]) ->
%% Filter out all the targets, based on the specified command.
FilteredTargets = [{Type, Dir, Filename} || {Type, Dir, Filename} <- Targets,
valid_command(Command, Type) == true],
- case apply_command(FilteredTargets, Command) of
+ case catch(apply_command(FilteredTargets, Command)) of
ok ->
apply_commands(Targets, Rest);
Other ->
@@ -175,6 +175,20 @@ apply_command([{Type, Dir, File} | Rest], Command) ->
ok = file:set_cwd(Dir),
Config = rebar_config:new(Dir),
+ %% Look for subdirs configuration list -- if it exists, we're going to process those first
+ case subdirs(rebar_config:get_list(Config, subdirs, []), []) of
+ [] ->
+ ok;
+ Subdirs ->
+ update_code_path(Subdirs),
+ case apply_command(Subdirs, Command) of
+ ok ->
+ ok = file:set_cwd(Dir);
+ error ->
+ ?FAIL
+ end
+ end,
+
%% Provide some info on where we are
?CONSOLE("==> ~s (~s)\n", [filename:basename(Dir), Command]),
@@ -185,9 +199,16 @@ apply_command([{Type, Dir, File} | Rest], Command) ->
ok ->
apply_command(Rest, Command);
Other ->
- ?ERROR("~p failed while processing ~s: ~p", [Command, Dir, Other])
+ ?ERROR("~p failed while processing ~s: ~p", [Command, Dir, Other]),
+ error
end.
+subdirs([], Acc) ->
+ Acc;
+subdirs([Dir | Rest], Acc) ->
+ Subdir = filename:join([rebar_utils:get_cwd(), Dir]),
+ subdirs(Rest, Acc ++ find_targets(Subdir)).
+
run_modules([], _Command, _Config, _File) ->
ok;