From 38de29ae424ecc2dd0ccee4c1ee4bf3a5bb021da Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 4 Apr 2015 16:08:25 -0500 Subject: move resource modules list to rebar_state, no longer static --- src/rebar3.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/rebar3.erl') diff --git a/src/rebar3.erl b/src/rebar3.erl index 87258aa..f853411 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -124,16 +124,18 @@ run_aux(State, GlobalPluginProviders, RawArgs) -> filename:join(filename:absname(rebar_state:dir(State2)), BaseDir)), {ok, Providers} = application:get_env(rebar, providers), - {ok, PluginProviders, State4} = rebar_plugins:install(State3), + {ok, Resources} = application:get_env(rebar, resources), + State4 = rebar_state:resources(State3, Resources), + {ok, PluginProviders, State5} = rebar_plugins:install(State4), %% Providers can modify profiles stored in opts, so set default after initializing providers AllProviders = Providers++PluginProviders++GlobalPluginProviders, - State5 = rebar_state:create_logic_providers(AllProviders, State4), - State6 = rebar_state:default(State5, rebar_state:opts(State5)), + State6 = rebar_state:create_logic_providers(AllProviders, State5), + State7 = rebar_state:default(State6, rebar_state:opts(State6)), {Task, Args} = parse_args(RawArgs), - rebar_core:init_command(rebar_state:command_args(State6, Args), Task). + rebar_core:init_command(rebar_state:command_args(State7, Args), Task). init_config() -> %% Initialize logging system -- cgit v1.1 From 79e2d6006c989a241d4599d048ff39f094f9e886 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 5 Apr 2015 08:52:57 -0500 Subject: install each deps plugins after handling dep, instead of at the end --- src/rebar3.erl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/rebar3.erl') diff --git a/src/rebar3.erl b/src/rebar3.erl index f853411..461206d 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -77,7 +77,7 @@ run(BaseState, Commands) -> _ = application:load(rebar), BaseState1 = rebar_state:set(BaseState, task, Commands), BaseState2 = rebar_state:set(BaseState1, caller, api), - run_aux(BaseState2, [], Commands). + run_aux(BaseState2, Commands). %% ==================================================================== %% Internal functions @@ -86,7 +86,7 @@ run(BaseState, Commands) -> run(RawArgs) -> _ = application:load(rebar), - {GlobalPluginProviders, BaseState} = init_config(), + BaseState = init_config(), BaseState1 = rebar_state:set(BaseState, caller, command_line), case erlang:system_info(version) of @@ -98,9 +98,9 @@ run(RawArgs) -> end, {BaseState2, _Args1} = set_options(BaseState1, {[], []}), - run_aux(BaseState2, GlobalPluginProviders, RawArgs). + run_aux(BaseState2, RawArgs). -run_aux(State, GlobalPluginProviders, RawArgs) -> +run_aux(State, RawArgs) -> %% Make sure crypto is running case crypto:start() of ok -> ok; @@ -126,11 +126,10 @@ run_aux(State, GlobalPluginProviders, RawArgs) -> {ok, Providers} = application:get_env(rebar, providers), {ok, Resources} = application:get_env(rebar, resources), State4 = rebar_state:resources(State3, Resources), - {ok, PluginProviders, State5} = rebar_plugins:install(State4), + State5 = rebar_plugins:install(State4), %% Providers can modify profiles stored in opts, so set default after initializing providers - AllProviders = Providers++PluginProviders++GlobalPluginProviders, - State6 = rebar_state:create_logic_providers(AllProviders, State5), + State6 = rebar_state:create_logic_providers(Providers, State5), State7 = rebar_state:default(State6, rebar_state:opts(State6)), {Task, Args} = parse_args(RawArgs), @@ -158,10 +157,9 @@ init_config() -> ?DEBUG("Load global config file ~p", [GlobalConfigFile]), GlobalConfig = rebar_state:new(global, rebar_config:consult_file(GlobalConfigFile)), - {ok, PluginProviders, GlobalConfig1} = rebar_plugins:install(GlobalConfig), + GlobalConfig1 = rebar_plugins:install(GlobalConfig), rebar_state:new(GlobalConfig1, Config1); false -> - PluginProviders = [], rebar_state:new(Config1) end, @@ -177,7 +175,7 @@ init_config() -> %% TODO: Do we need this still? I think it may still be used. %% Initialize vsn cache - {PluginProviders, rebar_state:set(State1, vsn_cache, dict:new())}. + rebar_state:set(State1, vsn_cache, dict:new()). parse_args([]) -> parse_args(["help"]); -- cgit v1.1