summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-06-06 12:38:20 -0400
committerFred Hebert <mononcqc@ferd.ca>2016-06-06 12:38:20 -0400
commitcfa0a7e40970a4cfe7d761dd876fd04bf0fd13d0 (patch)
treef03a5ce36fa5eef0ec31858546a1d4e18668bcf3 /src
parent821f82314e499d9e536f5d381136d3c71b8f0a75 (diff)
parent3038aae4ba91c48066e5fc71dfdbb2a06679ec92 (diff)
Merge pull request #1219 from ferd/umbrella-upgrade
Bugfix for upgrading deps of umbrella apps
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_upgrade.erl24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl
index c5c43e4..18c307b 100644
--- a/src/rebar_prv_upgrade.erl
+++ b/src/rebar_prv_upgrade.erl
@@ -45,7 +45,29 @@ init(State) ->
do(State) ->
{Args, _} = rebar_state:command_parsed_args(State),
Locks = rebar_state:get(State, {locks, default}, []),
- Deps = rebar_state:get(State, deps, []),
+ %% We have 3 sources of dependencies to upgrade from:
+ %% 1. the top-level rebar.config (in `deps', dep name is an atom)
+ %% 2. the app-level rebar.config in umbrella apps (in `{deps, default}',
+ %% where the dep name is an atom)
+ %% 3. the formatted sources for all after app-parsing (in `{deps, default}',
+ %% where the reprocessed app name is a binary)
+ %%
+ %% The gotcha with these is that the selection of dependencies with a
+ %% binary name (those that are stable and usable internally) is done with
+ %% in the profile deps only, but while accounting for locks.
+ %% Because our job here is to unlock those that have changed, we must
+ %% instead use the atom-based names, both in `deps' and `{deps, default}',
+ %% as those are the dependencies that may have changed but have been
+ %% disregarded by locks.
+ %%
+ %% As such, the working set of dependencies is the addition of
+ %% `deps' and `{deps, default}' entries with an atom name, as those
+ %% disregard locks and parsed values post-selection altogether.
+ %% Packages without versions can of course be a single atom.
+ TopDeps = rebar_state:get(State, deps, []),
+ ProfileDeps = rebar_state:get(State, {deps, default}, []),
+ Deps = [Dep || Dep <- TopDeps ++ ProfileDeps, % TopDeps > ProfileDeps
+ is_atom(Dep) orelse is_atom(element(1, Dep))],
Names = parse_names(ec_cnv:to_binary(proplists:get_value(package, Args, <<"">>)), Locks),
DepsDict = deps_dict(rebar_state:all_deps(State)),
case prepare_locks(Names, Deps, Locks, [], DepsDict) of