summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2019-05-21 10:32:56 -0400
committerGitHub <noreply@github.com>2019-05-21 10:32:56 -0400
commit4b7330101d01e25deada99224a50bbe308264913 (patch)
tree5ca4f05a86b50d970c60dd1a1163064e41a39466 /src
parentcf51007d9c7f58a61069037ec079c84b2760527b (diff)
parentd607bbf0d67e66e62af298d15256f3313ed0efe8 (diff)
Merge pull request #2083 from ferd/dont-apply-overrides-to-root
Do not apply overrides to a root application.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_app_discover.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl
index 21dea29..0c97ad7 100644
--- a/src/rebar_app_discover.erl
+++ b/src/rebar_app_discover.erl
@@ -52,7 +52,7 @@ do(State, LibDirs) ->
Name = rebar_app_info:name(AppInfo),
case enable(State, AppInfo) of
true ->
- {AppInfo1, StateAcc1} = merge_opts(AppInfo, StateAcc),
+ {AppInfo1, StateAcc1} = merge_opts(TopLevelApp, AppInfo, StateAcc),
OutDir = filename:join(DepsDir, Name),
AppInfo2 = rebar_app_info:out_dir(AppInfo1, OutDir),
ProjectDeps1 = lists:delete(Name, ProjectDeps),
@@ -91,9 +91,9 @@ format_error({missing_module, Module}) ->
%% some configuration like erl_opts must be merged into a subapp's opts
%% while plugins and hooks need to be kept defined to only either the
%% top level state or an individual application.
--spec merge_opts(rebar_app_info:t(), rebar_state:t()) ->
+-spec merge_opts(root | binary(), rebar_app_info:t(), rebar_state:t()) ->
{rebar_app_info:t(), rebar_state:t()}.
-merge_opts(AppInfo, State) ->
+merge_opts(TopLevelApp, AppInfo, State) ->
%% These steps make sure that hooks and artifacts are run in the context of
%% the application they are defined at. If an umbrella structure is used and
%% they are defined at the top level they will instead run in the context of
@@ -104,7 +104,12 @@ merge_opts(AppInfo, State) ->
Name = rebar_app_info:name(AppInfo1),
%% We reset the opts here to default so no profiles are applied multiple times
- AppInfo2 = rebar_app_info:apply_overrides(rebar_state:get(State1, overrides, []), AppInfo1),
+ AppInfo2 = case TopLevelApp of
+ Name -> % don't apply to the root app
+ AppInfo;
+ _ -> % apply overrides when in an umbrella project or on deps
+ rebar_app_info:apply_overrides(rebar_state:get(State1, overrides, []), AppInfo1)
+ end,
AppInfo3 = rebar_app_info:apply_profiles(AppInfo2, CurrentProfiles),
%% Will throw an exception if checks fail