summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Paxton <paxtonb@cargotel.com>2018-06-07 11:11:11 -0500
committerBryan Paxton <paxtonb@cargotel.com>2018-06-08 18:09:24 -0500
commitd1fc937515b312c1e5129e9e435e5b462f34b874 (patch)
treefcb132d8c5c42dd87b7024121bb60e58fd46d0ca /src
parent2c10bc97248e78e2aef1cdb8f87dd300ce954cca (diff)
Abort if erl_first_files is not a list of strings
- resolves #1645
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlc_compiler.erl8
-rw-r--r--src/rebar_utils.erl11
2 files changed, 18 insertions, 1 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index c588a25..ebdd9dd 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -285,6 +285,7 @@ gather_src(Opts, BaseDirParts, [Dir|Rest], Srcs, CompileOpts) ->
%% files, so that yet to be compiled parse transformations are excluded from it.
erl_first_files(Opts, ErlOpts, Dir, NeededErlFiles) ->
ErlFirstFilesConf = rebar_opts:get(Opts, erl_first_files, []),
+ valid_erl_first_conf(ErlFirstFilesConf),
NeededSrcDirs = lists:usort(lists:map(fun filename:dirname/1, NeededErlFiles)),
%% NOTE: order of files here is important!
ErlFirstFiles =
@@ -796,3 +797,10 @@ dir_recursive(Opts, Dir, CompileOpts) when is_list(CompileOpts) ->
undefined -> rebar_dir:recursive(Opts, Dir);
Recursive -> Recursive
end.
+
+valid_erl_first_conf(FileList) ->
+ case rebar_utils:is_list_of_strings(FileList) of
+ true -> true;
+ false -> ?ABORT("An invalid file list (~p) was provided as part of your erl_files_first directive",
+ [FileList])
+ end.
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 604abb8..2ded481 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -73,7 +73,8 @@
list_dir/1,
user_agent/0,
reread_config/1,
- get_proxy_auth/0]).
+ get_proxy_auth/0,
+ is_list_of_strings/1]).
%% for internal use only
@@ -919,3 +920,11 @@ get_proxy_auth() ->
undefined -> [];
{ok, ProxyAuth} -> ProxyAuth
end.
+
+-spec rebar_utils:is_list_of_strings(term()) -> boolean().
+is_list_of_strings(List) when not is_list(hd(List)) ->
+ false;
+is_list_of_strings(List) when is_list(hd(List)) ->
+ true;
+is_list_of_strings(List) when is_list(List) ->
+ true.