summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-09-28 17:27:31 -0500
committerTristan Sloughter <t@crashfast.com>2014-09-28 17:28:21 -0500
commit955f582a3ea6bb89b7b5df8ccdcbf48ab5fc815c (patch)
treed3d1728f804530bf8fb2c2db1f290fbac6f1836f
parentdb9ba68f801ec961313d0cdf9ceb03d79cc84d09 (diff)
fix for downloading transitive source deps
-rw-r--r--src/rebar.app.src1
-rw-r--r--src/rebar3.erl2
-rw-r--r--src/rebar_prv_install_deps.erl15
-rw-r--r--src/rebar_prv_update.erl39
4 files changed, 24 insertions, 33 deletions
diff --git a/src/rebar.app.src b/src/rebar.app.src
index daeacc0..ef6d8de 100644
--- a/src/rebar.app.src
+++ b/src/rebar.app.src
@@ -33,6 +33,7 @@
rebar_prv_tar,
rebar_prv_new,
rebar_prv_update,
+ rebar_prv_upgrade,
rebar_prv_release,
rebar_prv_version,
rebar_prv_help]}
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 5ab268f..20edfa6 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -44,7 +44,7 @@
%% escript Entry point
main(Args) ->
case catch(run(Args)) of
- ok ->
+ {ok, _State} ->
ok;
rebar_abort ->
rebar_utils:delayed_halt(1);
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 0092eaa..26d1712 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -74,7 +74,7 @@ do(State) ->
handle_deps(State, Locks)
end,
- Source = ProjectApps ++ rebar_state:src_deps(State1),
+ Source = ProjectApps ++ rebar_state:src_apps(State1),
{ok, Sort} = rebar_topo:sort_apps(Source),
{ok, rebar_state:set(State1, deps_to_build, lists:dropwhile(fun is_valid/1, Sort -- ProjectApps))}.
@@ -191,16 +191,21 @@ update_src_deps(Level, State, Update) ->
,NewBinaryDeps++BinaryDepsAcc
,rebar_state:src_apps(StateAcc, AppInfo2)};
false ->
- AppInfo1 = rebar_app_info:dep_level(AppInfo, Level),
- {SrcDepsAcc, BinaryDepsAcc, rebar_state:src_apps(StateAcc, AppInfo1)}
+ {AppInfo1, NewSrcDeps, NewBinaryDeps} =
+ handle_dep(DepsDir, AppInfo),
+ AppInfo2 = rebar_app_info:dep_level(AppInfo1, Level),
+ {NewSrcDeps ++ SrcDepsAcc
+ ,NewBinaryDeps++BinaryDepsAcc
+ ,rebar_state:src_apps(StateAcc, AppInfo2)}
end
end
end, {[], rebar_state:binary_deps(State), State}, SrcDeps) of
{[], NewBinaryDeps, State1} ->
rebar_state:binary_deps(State1, NewBinaryDeps);
- {_NewSrcDeps, NewBinaryDeps, State1} ->
+ {NewSrcDeps, NewBinaryDeps, State1} ->
State2 = rebar_state:binary_deps(State1, NewBinaryDeps),
- update_src_deps(Level+1, State2, Update)
+ State3 = rebar_state:src_deps(State2, NewSrcDeps),
+ update_src_deps(Level+1, State3, Update)
end.
-spec handle_dep(file:filename_all(), rebar_app_info:t()) ->
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index bfe3ab6..e1648e2 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -23,40 +23,25 @@ init(State) ->
provider_impl = ?MODULE,
bare = false,
deps = ?DEPS,
- example = "rebar update cowboy",
- short_desc = "Update package index or individual dependency.",
+ example = "rebar update",
+ short_desc = "Update package index.",
desc = "",
opts = []}),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
do(State) ->
- case rebar_state:command_args(State) of
- [Name] ->
- ?INFO("Updating ~s~n", [Name]),
- Locks = rebar_state:get(State, locks, []),
- case lists:keyfind(ec_cnv:to_binary(Name), 1, Locks) of
- {_, _, _, Level} ->
- Deps = rebar_state:get(State, deps),
- Dep = lists:keyfind(list_to_atom(Name), 1, Deps),
- rebar_prv_install_deps:handle_deps(State, [Dep], {true, ec_cnv:to_binary(Name), Level}),
- {ok, State};
- false ->
- {error, io_lib:format("No such dependency ~s~n", [Name])}
- end;
- [] ->
- ?INFO("Updating package index...~n", []),
- try
- Url = url(State),
+ ?INFO("Updating package index...~n", []),
+ try
+ Url = url(State),
%{ok, [Home]} = init:get_argument(home),
- ec_file:mkdir_p(filename:join([os:getenv("HOME"), ".rebar"])),
- PackagesFile = filename:join([os:getenv("HOME"), ".rebar", "packages"]),
- {ok, RequestId} = httpc:request(get, {Url, []}, [], [{stream, PackagesFile}
- ,{sync, true}])
- catch
- _:_ ->
- {error, io_lib:format("Failed to write package index.~n", [])}
- end
+ ec_file:mkdir_p(filename:join([os:getenv("HOME"), ".rebar"])),
+ PackagesFile = filename:join([os:getenv("HOME"), ".rebar", "packages"]),
+ {ok, RequestId} = httpc:request(get, {Url, []}, [], [{stream, PackagesFile}
+ ,{sync, true}])
+ catch
+ _:_ ->
+ {error, io_lib:format("Failed to write package index.~n", [])}
end.
url(State) ->