From 3abb122b3557b62ce9a621f86f847b997aa540b1 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 30 Nov 2014 08:58:54 -0600 Subject: only apply profiles to default --- src/rebar.app.src | 3 +-- src/rebar_state.erl | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/rebar.app.src b/src/rebar.app.src index 0341f79..5ef2c2f 100644 --- a/src/rebar.app.src +++ b/src/rebar.app.src @@ -41,7 +41,6 @@ rebar_prv_release, rebar_prv_version, rebar_prv_common_test, - rebar_prv_help, - rebar_prv_test_deps]} + rebar_prv_help]} ]} ]}. diff --git a/src/rebar_state.erl b/src/rebar_state.erl index 8b793a2..bfcc1e7 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -29,6 +29,7 @@ -record(state_t, {dir :: file:name(), opts = dict:new() :: rebar_dict(), + default = dict:new() :: rebar_dict(), lock = [], current_profile = default :: atom(), @@ -51,15 +52,19 @@ new() -> -spec new(list()) -> t(). new(Config) when is_list(Config) -> + Opts = dict:from_list(Config), #state_t { dir = rebar_utils:get_cwd(), - opts = dict:from_list(Config) }. + default = Opts, + opts = Opts }. -spec new(t() | atom(), list()) -> t(). new(Profile, Config) when is_atom(Profile) , is_list(Config) -> + Opts = dict:from_list(Config), #state_t { dir = rebar_utils:get_cwd(), current_profile = Profile, - opts = dict:from_list(Config) }; + default = Opts, + opts = Opts }; new(ParentState=#state_t{}, Config) -> %% Load terms from rebar.config, if it exists Dir = rebar_utils:get_cwd(), @@ -74,13 +79,14 @@ new(ParentState, Config, Dir) -> _ -> dict:from_list(Config) end, - + NewOpts = dict:merge(fun(_Key, Value1, _Value2) -> + Value1 + end, LocalOpts, Opts), ProviderModules = [], create_logic_providers(ProviderModules ,ParentState#state_t{dir=Dir - ,opts=dict:merge(fun(_Key, Value1, _Value2) -> - Value1 - end, LocalOpts, Opts)}). + ,opts=NewOpts + ,default=NewOpts}). get(State, Key) -> {ok, Value} = dict:find(Key, State#state_t.opts), @@ -122,7 +128,8 @@ command_parsed_args(#state_t{command_parsed_args=CmdArgs}) -> command_parsed_args(State, CmdArgs) -> State#state_t{command_parsed_args=CmdArgs}. -apply_profile(State=#state_t{opts=Opts}, Profile) -> +%% Only apply profiles to the default profile +apply_profile(State=#state_t{default=Opts}, Profile) -> ConfigProfiles = rebar_state:get(State, profiles, []), Deps = rebar_state:get(State, deps, []), Opts1 = dict:store({deps, default}, Deps, dict:erase(deps, Opts)), -- cgit v1.1