Просмотр исходного кода

support base dir and properly reset deps_dir after plugin provider

pull/3/head
Tristan Sloughter 10 лет назад
Родитель
Сommit
557de6f8b4
2 измененных файлов: 10 добавлений и 7 удалений
  1. +8
    -6
      src/rebar3.erl
  2. +2
    -1
      src/rebar_plugins.erl

+ 8
- 6
src/rebar3.erl Просмотреть файл

@ -82,7 +82,7 @@ run(BaseState, Command) ->
%% ==================================================================== %% ====================================================================
run(RawArgs) -> run(RawArgs) ->
ok = load_rebar_app(),
_ = application:load(rebar),
BaseConfig = init_config(), BaseConfig = init_config(),
case erlang:system_info(version) of case erlang:system_info(version) of
@ -95,10 +95,6 @@ run(RawArgs) ->
{BaseConfig1, _Args1} = set_options(BaseConfig, {[], []}), {BaseConfig1, _Args1} = set_options(BaseConfig, {[], []}),
run_aux(BaseConfig1, RawArgs). run_aux(BaseConfig1, RawArgs).
load_rebar_app() ->
%% Pre-load the rebar app so that we get default configuration
ok = application:load(rebar).
init_config() -> init_config() ->
%% Initialize logging system %% Initialize logging system
Verbosity = log_level(), Verbosity = log_level(),
@ -158,7 +154,13 @@ run_aux(State, RawArgs) ->
State1 = init_config1(State), State1 = init_config1(State),
%% Process each command, resetting any state between each one %% 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, Providers} = application:get_env(rebar, providers),
{ok, PluginProviders, State3} = rebar_plugins:install(State2), {ok, PluginProviders, State3} = rebar_plugins:install(State2),

+ 2
- 1
src/rebar_plugins.erl Просмотреть файл

@ -12,6 +12,7 @@
%% =================================================================== %% ===================================================================
install(State) -> install(State) ->
DepsDir = rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIR),
State1 = rebar_state:set(State, deps_dir, ?DEFAULT_PLUGINS_DIR), State1 = rebar_state:set(State, deps_dir, ?DEFAULT_PLUGINS_DIR),
expand_plugins(?DEFAULT_PLUGINS_DIR), expand_plugins(?DEFAULT_PLUGINS_DIR),
Plugins = rebar_state:get(State1, plugins, []), Plugins = rebar_state:get(State1, plugins, []),
@ -19,7 +20,7 @@ install(State) ->
handle_plugin(Plugin, State1) handle_plugin(Plugin, State1)
end, Plugins), 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) -> handle_plugin(Plugin, State) ->
try try

Загрузка…
Отмена
Сохранить