summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-09-02 21:33:29 -0500
committerTristan Sloughter <t@crashfast.com>2014-09-02 21:33:29 -0500
commit6c50d0a5669722e083d7999b6268f0e3858a3293 (patch)
treee89d04a3f4d77fe29c0c0942dc41652e6bd5e3df
parent63ec4cdef6a9a66107ddff7ea3b9c5b97074c6bf (diff)
fix fetch and build
-rw-r--r--src/rebar_app_info.erl11
-rw-r--r--src/rebar_prv_install_deps.erl16
2 files changed, 17 insertions, 10 deletions
diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl
index fb2c5f9..dc0d298 100644
--- a/src/rebar_app_info.erl
+++ b/src/rebar_app_info.erl
@@ -35,7 +35,7 @@
app_file :: file:name(),
config :: rebar_config:config() | undefined,
original_vsn :: string(),
- app_details :: list(),
+ app_details=[] :: list(),
deps=[] :: list(),
dir :: file:name(),
source :: string() | undefined,
@@ -87,9 +87,12 @@ new(AppName, Vsn, Dir, Deps) ->
-spec discover(file:name()) ->
{ok, t()}.
discover(Dir) ->
- {true, AppInfo} = rebar_app_discover:find_app(Dir, all),
- {ok, AppInfo}.
-
+ case rebar_app_discover:find_app(Dir, all) of
+ {true, AppInfo} ->
+ {ok, AppInfo};
+ _ ->
+ not_found
+ end.
-spec name(t()) -> atom().
name(#app_info_t{name=Name}) ->
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index faca012..38bd110 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -69,8 +69,7 @@ do(State) ->
[] ->
handle_deps(State, ordsets:from_list(rebar_state:get(State, deps, [])));
Locks ->
- handle_deps(State, ordsets:from_list(Locks)),
- {ok, State}
+ handle_deps(State, ordsets:from_list(Locks))
end.
%% set REBAR_DEPS_DIR and ERL_LIBS environment variables
@@ -146,7 +145,7 @@ handle_deps(State, Deps) ->
%% Sort all apps to build order
State3 = rebar_state:set(State2, all_deps, AllDeps),
{ok, Sort} = rebar_topo:sort_apps(ordsets:to_list(Source)),
- {ok, rebar_state:set(State3, deps_to_build, lists:dropwhile(fun is_valid/1, Sort) -- ProjectApps)}.
+ {ok, rebar_state:set(State3, deps_to_build, lists:dropwhile(fun is_valid/1, Sort -- ProjectApps))}.
-spec is_valid(rebar_app_info:t()) -> boolean().
is_valid(App) ->
@@ -211,9 +210,14 @@ parse_deps(DepsDir, Deps) ->
,ec_cnv:to_binary(Vsn)) | BinaryDepsAcc]};
(Name, {SrcDepsAcc, BinaryDepsAcc}) when is_atom(Name) ->
{SrcDepsAcc, [ec_cnv:to_binary(Name) | BinaryDepsAcc]};
- ({Name, _Vsn, Source}, {SrcDepsAcc, BinaryDepsAcc}) when is_tuple (Source) ->
- {ok, Dep} =
- rebar_app_info:discover(ec_cnv:to_list(get_deps_dir(DepsDir, Name))),
+ ({Name, Vsn, Source}, {SrcDepsAcc, BinaryDepsAcc}) when is_tuple (Source) ->
+ Dir = ec_cnv:to_list(get_deps_dir(DepsDir, Name)),
+ {ok, Dep} = case rebar_app_info:discover(Dir) of
+ {ok, App} ->
+ {ok, App};
+ not_found ->
+ rebar_app_info:new(Name, Vsn, Dir)
+ end,
Dep1 = rebar_app_info:source(Dep, Source),
{ordsets:add_element(Dep1, SrcDepsAcc), BinaryDepsAcc}
end, {ordsets:new(), []}, Deps).