diff options
Diffstat (limited to 'src/rebar_app_discover.erl')
-rw-r--r-- | src/rebar_app_discover.erl | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 6eeadf0..e81a323 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -20,15 +20,7 @@ do(State, LibDirs) -> %% There may be a top level src which is an app and there may not %% Find it here if there is, otherwise define the deps parent as root - TopLevelApp = case ec_lists:find(fun(X) -> - ec_file:real_dir_path(rebar_app_info:dir(X)) =:= - ec_file:real_dir_path(rebar_dir:root_dir(State)) - end, Apps) of - {ok, App} -> - rebar_app_info:name(App); - error -> - root - end, + TopLevelApp = define_root_app(Apps, State), %% Handle top level deps State1 = lists:foldl(fun(Profile, StateAcc) -> @@ -61,6 +53,18 @@ do(State, LibDirs) -> end end, State1, SortedApps). +define_root_app(Apps, State) -> + RootDir = rebar_dir:root_dir(State), + case ec_lists:find(fun(X) -> + ec_file:real_dir_path(rebar_app_info:dir(X)) =:= + ec_file:real_dir_path(RootDir) + end, Apps) of + {ok, App} -> + rebar_app_info:name(App); + error -> + root + end. + format_error({module_list, File}) -> io_lib:format("Error reading module list from ~p~n", [File]); format_error({missing_module, Module}) -> |