summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-05-31 18:20:55 -0400
committerFred Hebert <mononcqc@ferd.ca>2015-05-31 18:20:55 -0400
commit7ac9f0df6996fc5efe19d10ef232b5b8b8ad70f1 (patch)
tree833211d174663e6dbc15fc2c0f0749aeac9ce83d
parent5a3e3bdc303f3578015e372b1fa5e1b22b303d46 (diff)
parentea07a7c65c194ff4e6f3a03dde424a8b1b035d8c (diff)
Merge pull request #491 from tsloughter/pre_plugin_providers
set default providers before installing plugins
-rw-r--r--src/rebar3.erl5
-rw-r--r--src/rebar_plugins.erl9
2 files changed, 7 insertions, 7 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 5321278..4e90d82 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -98,10 +98,9 @@ run_aux(State, RawArgs) ->
filename:join(filename:absname(rebar_state:dir(State2)), BaseDir)),
{ok, Providers} = application:get_env(rebar, providers),
- State4 = rebar_plugins:install(State3),
-
%% Providers can modify profiles stored in opts, so set default after initializing providers
- State5 = rebar_state:create_logic_providers(Providers, State4),
+ State4 = rebar_state:create_logic_providers(Providers, State3),
+ State5 = rebar_plugins:install(State4),
State6 = rebar_state:default(State5, rebar_state:opts(State5)),
{Task, Args} = parse_args(RawArgs),
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl
index c4644dc..88cb8b8 100644
--- a/src/rebar_plugins.erl
+++ b/src/rebar_plugins.erl
@@ -60,7 +60,7 @@ handle_plugin(Profile, Plugin, State) ->
code:add_pathsa(CodePaths),
%% Build plugin and its deps
- [build_plugin(AppInfo) || AppInfo <- ToBuild],
+ [build_plugin(AppInfo, Apps, State) || AppInfo <- ToBuild],
%% Add newly built deps and plugin to code path
State3 = rebar_state:update_all_plugin_deps(State2, Apps),
@@ -78,11 +78,12 @@ handle_plugin(Profile, Plugin, State) ->
{[], State}
end.
-build_plugin(AppInfo) ->
+build_plugin(AppInfo, Apps, State) ->
+ Providers = rebar_state:providers(State),
AppDir = rebar_app_info:dir(AppInfo),
C = rebar_config:consult(AppDir),
- S = rebar_state:new(rebar_state:new(), C, AppDir),
- rebar_prv_compile:compile(S, [], AppInfo).
+ S = rebar_state:new(rebar_state:all_deps(rebar_state:new(), Apps), C, AppDir),
+ rebar_prv_compile:compile(S, Providers, AppInfo).
plugin_providers({Plugin, _, _, _}) when is_atom(Plugin) ->
validate_plugin(Plugin);