diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-10-04 22:16:17 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-10-04 22:16:17 -0400 |
commit | a74eb69a8364fdad0a8e376072b97b46cc2fae4e (patch) | |
tree | 83f2a8e265246eecb97db6e238454e5b62c0025a /src | |
parent | 2b228fafce32b7b523c1649d86926ae18ceb1346 (diff) | |
parent | ea56749f73bc1efd7108119dae329f3cb1772b9b (diff) |
Merge pull request #852 from tsloughter/no_profile
print a warning if a profile in 'as' has no config entry
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_as.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rebar_prv_as.erl b/src/rebar_prv_as.erl index ead7b01..b4f7ac4 100644 --- a/src/rebar_prv_as.erl +++ b/src/rebar_prv_as.erl @@ -37,6 +37,7 @@ do(State) -> [] -> {error, "At least one profile must be specified when using `as`"}; _ -> + warn_on_empty_profile(Profiles, State), State1 = rebar_state:apply_profiles(State, [list_to_atom(X) || X <- Profiles]), State2 = rebar_plugins:project_apps_install(State1), {FirstTask, FirstTaskArgs} = hd(Tasks), @@ -89,3 +90,14 @@ comma_or_end(["," ++ Profile|Rest], Acc) -> profiles([Profile|Rest], Acc); comma_or_end(Tasks, Acc) -> {lists:reverse(Acc), rebar_utils:args_to_tasks(Tasks)}. + +%% If a profile is used by 'as' but has no entry under `profile` within +%% the top level rebar.config or any project app's rebar.config print a warning. +%% This is just to help developers, in case they forgot to define a profile but +%% thought it was being used. +warn_on_empty_profile(Profiles, State) -> + ProjectApps = rebar_state:project_apps(State), + DefinedProfiles = rebar_state:get(State, profiles, []) ++ + lists:flatten([rebar_app_info:get(AppInfo, profiles, []) || AppInfo <- ProjectApps]), + [?WARN("No entry for profile ~s in config.", [Profile]) || + Profile <- Profiles, not(lists:keymember(list_to_atom(Profile), 1, DefinedProfiles))]. |