소스 검색

only apply profiles to default

pull/31/head
Tristan Sloughter 10 년 전
부모
커밋
3abb122b35
2개의 변경된 파일15개의 추가작업 그리고 9개의 파일을 삭제
  1. +1
    -2
      src/rebar.app.src
  2. +14
    -7
      src/rebar_state.erl

+ 1
- 2
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]}
]}
]}.

+ 14
- 7
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)),

불러오는 중...
취소
저장