summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar3.erl14
-rw-r--r--src/rebar_plugins.erl3
2 files changed, 10 insertions, 7 deletions
diff --git a/src/rebar3.erl b/src/rebar3.erl
index ecfd67e..0a85c41 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -82,7 +82,7 @@ run(BaseState, Command) ->
%% ====================================================================
run(RawArgs) ->
- ok = load_rebar_app(),
+ _ = application:load(rebar),
BaseConfig = init_config(),
case erlang:system_info(version) of
@@ -95,10 +95,6 @@ run(RawArgs) ->
{BaseConfig1, _Args1} = set_options(BaseConfig, {[], []}),
run_aux(BaseConfig1, RawArgs).
-load_rebar_app() ->
- %% Pre-load the rebar app so that we get default configuration
- ok = application:load(rebar).
-
init_config() ->
%% Initialize logging system
Verbosity = log_level(),
@@ -158,7 +154,13 @@ run_aux(State, RawArgs) ->
State1 = init_config1(State),
%% Process each command, resetting any state between each one
- State2 = rebar_state:set(State1, base_dir, filename:absname(rebar_state:dir(State1))),
+ State2 = case rebar_state:get(State1, base_dir, undefined) of
+ undefined ->
+ rebar_state:set(State1, base_dir, filename:absname(rebar_state:dir(State1)));
+ Dir ->
+ rebar_state:set(State1, base_dir, filename:absname(Dir))
+ end,
+
{ok, Providers} = application:get_env(rebar, providers),
{ok, PluginProviders, State3} = rebar_plugins:install(State2),
diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl
index 3bf9f0b..1916c11 100644
--- a/src/rebar_plugins.erl
+++ b/src/rebar_plugins.erl
@@ -12,6 +12,7 @@
%% ===================================================================
install(State) ->
+ DepsDir = rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIR),
State1 = rebar_state:set(State, deps_dir, ?DEFAULT_PLUGINS_DIR),
expand_plugins(?DEFAULT_PLUGINS_DIR),
Plugins = rebar_state:get(State1, plugins, []),
@@ -19,7 +20,7 @@ install(State) ->
handle_plugin(Plugin, State1)
end, Plugins),
- {ok, PluginProviders, rebar_state:set(State1, deps_dir, ?DEFAULT_DEPS_DIR)}.
+ {ok, PluginProviders, rebar_state:set(State1, deps_dir, DepsDir)}.
handle_plugin(Plugin, State) ->
try