summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-05-28 11:07:38 -0500
committerTristan Sloughter <t@crashfast.com>2015-05-28 22:13:31 -0500
commit7d33dbf6aab358751c1edb9a25174ae811b6a0d7 (patch)
tree2d09d7b39c99a2633553ea2d6cc19fd34ca488e3 /src
parent4ff95cee31cb7d06bd239e4d4ccbf8b59cdebdda (diff)
store plugin providers in app_info's state for deps
Diffstat (limited to 'src')
-rw-r--r--src/rebar_core.erl1
-rw-r--r--src/rebar_hooks.erl4
-rw-r--r--src/rebar_prv_compile.erl1
-rw-r--r--src/rebar_prv_install_deps.erl31
4 files changed, 28 insertions, 9 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index 7fe7332..c7cc45a 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -119,6 +119,7 @@ do([ProviderName | Rest], State) ->
,rebar_state:providers(State)
,rebar_state:namespace(State))
end,
+
case providers:do(Provider, State) of
{ok, State1} ->
do(Rest, State1);
diff --git a/src/rebar_hooks.erl b/src/rebar_hooks.erl
index 037a85a..4ec46f7 100644
--- a/src/rebar_hooks.erl
+++ b/src/rebar_hooks.erl
@@ -12,10 +12,12 @@ run_all_hooks(Dir, Type, Command, Providers, State) ->
run_provider_hooks(Dir, Type, Command, Providers, State) ->
PluginDepsPaths = rebar_state:code_paths(State, all_plugin_deps),
code:add_pathsa(PluginDepsPaths),
- State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers),
+ Providers1 = rebar_state:providers(State),
+ State1 = rebar_state:providers(rebar_state:dir(State, Dir), Providers++Providers1),
AllHooks = rebar_state:get(State1, provider_hooks, []),
TypeHooks = proplists:get_value(Type, AllHooks, []),
HookProviders = proplists:get_all_values(Command, TypeHooks),
+
State2 = rebar_core:do(HookProviders, State1),
rebar_utils:remove_from_code_path(PluginDepsPaths),
State2.
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index c60406d..c98cf45 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -36,7 +36,6 @@ do(State) ->
rebar_utils:remove_from_code_path(PluginDepsPaths),
code:add_pathsa(DepsPaths),
-
ProjectApps = rebar_state:project_apps(State),
Providers = rebar_state:providers(State),
Deps = rebar_state:deps_to_build(State),
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 23f2830..eb24a9d 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -227,7 +227,22 @@ handle_pkg_dep(Profile, Pkg, Packages, Upgrade, DepsDir, Fetched, Seen, Locks, S
Level = rebar_app_info:dep_level(AppInfo),
{NewSeen, NewState} = maybe_lock(Profile, AppInfo, Seen, State, Level),
{_, AppInfo1} = maybe_fetch(AppInfo, Profile, Upgrade, Seen, NewState),
- {[AppInfo1 | Fetched], NewSeen, NewState}.
+
+ Profiles = rebar_state:current_profiles(State),
+ Name = rebar_app_info:name(AppInfo1),
+ C = rebar_config:consult(rebar_app_info:dir(AppInfo1)),
+ BaseDir = rebar_state:get(State, base_dir, []),
+ S1 = rebar_state:new(rebar_state:set(rebar_state:new(), base_dir, BaseDir),
+ C, rebar_app_info:dir(AppInfo1)),
+ S2 = rebar_state:apply_profiles(S1, Profiles),
+ S3 = rebar_state:apply_overrides(S2, Name),
+ AppInfo2 = rebar_app_info:state(AppInfo1, S3),
+
+ %% Dep may have plugins to install. Find and install here.
+ S4 = rebar_plugins:handle_plugins(rebar_state:get(S3, plugins, []), S3),
+ AppInfo3 = rebar_app_info:state(AppInfo2, S4),
+
+ {[AppInfo3 | Fetched], NewSeen, NewState}.
maybe_lock(Profile, AppInfo, Seen, State, Level) ->
case rebar_app_info:is_checkout(AppInfo) of
@@ -386,14 +401,16 @@ handle_dep(State, DepsDir, AppInfo, Locks, Level) ->
AppInfo1 = rebar_app_info:state(AppInfo, S3),
%% Dep may have plugins to install. Find and install here.
- State1 = rebar_plugins:handle_plugins(rebar_state:get(S3, plugins, []), State),
- Deps = rebar_state:get(S3, deps, []),
+ S4 = rebar_plugins:handle_plugins(rebar_state:get(S3, plugins, []), S3),
+ AppInfo2 = rebar_app_info:state(AppInfo1, S4),
+
%% Upgrade lock level to be the level the dep will have in this dep tree
+ Deps = rebar_state:get(S4, deps, []),
NewLocks = [{DepName, Source, LockLevel+Level} ||
- {DepName, Source, LockLevel} <- rebar_state:get(S3, {locks, default}, [])],
- AppInfo2 = rebar_app_info:deps(AppInfo1, rebar_state:deps_names(Deps)),
- {SrcDeps, PkgDeps} = parse_deps(DepsDir, Deps, S3, Locks, Level+1),
- {AppInfo2, SrcDeps, PkgDeps, Locks++NewLocks, State1}.
+ {DepName, Source, LockLevel} <- rebar_state:get(S4, {locks, default}, [])],
+ AppInfo3 = rebar_app_info:deps(AppInfo2, rebar_state:deps_names(Deps)),
+ {SrcDeps, PkgDeps} = parse_deps(DepsDir, Deps, S4, Locks, Level+1),
+ {AppInfo3, SrcDeps, PkgDeps, Locks++NewLocks, State}.
-spec maybe_fetch(rebar_app_info:t(), atom(), boolean(),
sets:set(binary()), rebar_state:t()) -> {boolean(), rebar_app_info:t()}.