summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2016-01-10 09:21:08 -0600
committerTristan Sloughter <t@crashfast.com>2016-01-10 09:21:08 -0600
commit414dd344e96ac4cb430c3e055b26ac73a6a988b0 (patch)
tree3ff4a9c5bed6108c625a33df79c46268a4bdeec2 /src
parenta479c2f392c609e1ada2ee6ec97051fd2a3d00f6 (diff)
install project app plugins after discovering them not before
Diffstat (limited to 'src')
-rw-r--r--src/rebar3.erl2
-rw-r--r--src/rebar_plugins.erl12
-rw-r--r--src/rebar_prv_app_discovery.erl3
3 files changed, 13 insertions, 4 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 9106bb8..84d7c3e 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -123,7 +123,7 @@ run_aux(State, RawArgs) ->
{ok, Providers} = application:get_env(rebar, providers),
%% Providers can modify profiles stored in opts, so set default after initializing providers
State5 = rebar_state:create_logic_providers(Providers, State4),
- State6 = rebar_plugins:project_apps_install(State5),
+ State6 = rebar_plugins:top_level_install(State5),
State7 = rebar_state:default(State6, rebar_state:opts(State6)),
{Task, Args} = parse_args(RawArgs),
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl
index f2d3977..b4cc3ec 100644
--- a/src/rebar_plugins.erl
+++ b/src/rebar_plugins.erl
@@ -3,7 +3,8 @@
-module(rebar_plugins).
--export([project_apps_install/1
+-export([top_level_install/1
+ ,project_apps_install/1
,install/2
,handle_plugins/3
,handle_plugins/4]).
@@ -14,11 +15,18 @@
%% Public API
%% ===================================================================
+-spec top_level_install(rebar_state:t()) -> rebar_state:t().
+top_level_install(State) ->
+ Profiles = rebar_state:current_profiles(State),
+ lists:foldl(fun(Profile, StateAcc) ->
+ Plugins = rebar_state:get(State, {plugins, Profile}, []),
+ handle_plugins(Profile, Plugins, StateAcc)
+ end, State, Profiles).
+
-spec project_apps_install(rebar_state:t()) -> rebar_state:t().
project_apps_install(State) ->
Profiles = rebar_state:current_profiles(State),
ProjectApps = rebar_state:project_apps(State),
-
lists:foldl(fun(Profile, StateAcc) ->
Plugins = rebar_state:get(State, {plugins, Profile}, []),
StateAcc1 = handle_plugins(Profile, Plugins, StateAcc),
diff --git a/src/rebar_prv_app_discovery.erl b/src/rebar_prv_app_discovery.erl
index 5449f82..1954214 100644
--- a/src/rebar_prv_app_discovery.erl
+++ b/src/rebar_prv_app_discovery.erl
@@ -36,7 +36,8 @@ do(State) ->
LibDirs = rebar_dir:lib_dirs(State),
try
State1 = rebar_app_discover:do(State, LibDirs),
- {ok, State1}
+ State2 = rebar_plugins:project_apps_install(State1),
+ {ok, State2}
catch
throw:{error, {rebar_packages, Error}} ->
{error, {rebar_packages, Error}};