summaryrefslogtreecommitdiff
path: root/src/rebar_state.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-30 08:58:54 -0600
committerTristan Sloughter <t@crashfast.com>2014-11-30 08:58:54 -0600
commit3abb122b3557b62ce9a621f86f847b997aa540b1 (patch)
tree6d52a556f77f26f9f6499a08c23f0e8564d2c8e7 /src/rebar_state.erl
parentd6e16325f077edf8b8d9c0e3ffad4f131d78c67b (diff)
only apply profiles to default
Diffstat (limited to 'src/rebar_state.erl')
-rw-r--r--src/rebar_state.erl21
1 files changed, 14 insertions, 7 deletions
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)),