diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-03-04 10:11:34 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-03-04 18:48:42 -0600 |
commit | 4a2996a7560e12c9897b4a7b333dee3e9fa66347 (patch) | |
tree | 5cc3b41aca1cd03c26a6645754001bfaccccc416 /src | |
parent | 49af56ff236ced8471fb9c52083c92ca7dfca473 (diff) |
fix for profiles_remain_applied_with_config_present
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_app_discover.erl | 24 | ||||
-rw-r--r-- | src/rebar_core.erl | 8 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index 761c09e..553947a 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -19,13 +19,13 @@ do(State, LibDirs) -> %% Sort apps so we get the same merged deps config everytime SortedApps = rebar_utils:sort_deps(Apps), lists:foldl(fun(AppInfo, StateAcc) -> - StateAcc1 = merge_deps(AppInfo, StateAcc), + {AppInfo1, StateAcc1} = merge_deps(AppInfo, StateAcc), Name = rebar_app_info:name(AppInfo), OutDir = filename:join(DepsDir, Name), - AppInfo1 = rebar_app_info:out_dir(AppInfo, OutDir), + AppInfo2 = rebar_app_info:out_dir(AppInfo1, OutDir), ProjectDeps1 = lists:delete(Name, ProjectDeps), rebar_state:project_apps(StateAcc1 - ,rebar_app_info:deps(AppInfo1, ProjectDeps1)) + ,rebar_app_info:deps(AppInfo2, ProjectDeps1)) end, State, SortedApps). format_error({module_list, File}) -> @@ -37,15 +37,21 @@ merge_deps(AppInfo, State) -> Profiles = rebar_state:current_profiles(State), Name = rebar_app_info:name(AppInfo), C = rebar_config:consult(rebar_app_info:dir(AppInfo)), + AppState = rebar_state:apply_overrides( rebar_state:apply_profiles( rebar_state:new(State, C, rebar_app_info:dir(AppInfo)), Profiles), Name), - lists:foldl(fun(Profile, StateAcc) -> - AppProfDeps = rebar_state:get(AppState, {deps, Profile}, []), - TopLevelProfDeps = rebar_state:get(StateAcc, {deps, Profile}, []), - ProfDeps2 = lists:keymerge(1, TopLevelProfDeps, AppProfDeps), - rebar_state:set(StateAcc, {deps, Profile}, ProfDeps2) - end, State, lists:reverse(Profiles)). + AppInfo1 = rebar_app_info:state(AppInfo, AppState), + + State1 = lists:foldl(fun(Profile, StateAcc) -> + AppProfDeps = rebar_state:get(AppState, {deps, Profile}, []), + TopLevelProfDeps = rebar_state:get(StateAcc, {deps, Profile}, []), + ProfDeps2 = lists:keymerge(1, TopLevelProfDeps, AppProfDeps), + rebar_state:set(StateAcc, {deps, Profile}, ProfDeps2) + end, State, lists:reverse(Profiles)), + + + {AppInfo1, State1}. -spec all_app_dirs(list(file:name())) -> list(file:name()). all_app_dirs(LibDirs) -> diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 4497825..205258a 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -78,14 +78,12 @@ process_command(State, Command) -> Command when Command =:= do; Command =:= as -> do(TargetProviders, State); _ -> - Profiles = providers:profiles(CommandProvider), - State1 = rebar_state:apply_profiles(State, Profiles), Opts = providers:opts(CommandProvider)++rebar3:global_option_spec_list(), - case getopt:parse(Opts, rebar_state:command_args(State1)) of + case getopt:parse(Opts, rebar_state:command_args(State)) of {ok, Args} -> - State2 = rebar_state:command_parsed_args(State1, Args), - do(TargetProviders, State2); + State1 = rebar_state:command_parsed_args(State, Args), + do(TargetProviders, State1); {error, {invalid_option, Option}} -> {error, io_lib:format("Invalid option ~s on task ~p", [Option, Command])} end |