diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2018-06-28 15:20:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-28 15:20:16 -0400 |
commit | 940b1c594fdc54ae5d68f7fb8756e1b95d29e576 (patch) | |
tree | 288982589294b796bd645d429a861173a5716f12 /src/rebar_erlc_compiler.erl | |
parent | 5a3c8e5b3d74e619d9ea82d8004cb01d65a21443 (diff) | |
parent | a8426aba8a7b86891d6f47fa3b7323cf35a786b1 (diff) |
Merge pull request #1828 from starbelly/erl_first_files_atom_support
Warn but succeed when atoms are passed to erl_first_files
Diffstat (limited to 'src/rebar_erlc_compiler.erl')
-rw-r--r-- | src/rebar_erlc_compiler.erl | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index ebdd9dd..920c3b4 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -799,8 +799,27 @@ dir_recursive(Opts, Dir, CompileOpts) when is_list(CompileOpts) -> end. valid_erl_first_conf(FileList) -> - case rebar_utils:is_list_of_strings(FileList) of + Strs = filter_file_list(FileList), + case rebar_utils:is_list_of_strings(Strs) of true -> true; false -> ?ABORT("An invalid file list (~p) was provided as part of your erl_files_first directive", [FileList]) end. + +filter_file_list(FileList) -> + Atoms = lists:filter( fun(X) -> is_atom(X) end, FileList), + case Atoms of + [] -> + FileList; + _ -> + atoms_in_erl_first_files_warning(Atoms), + lists:filter( fun(X) -> not(is_atom(X)) end, FileList) + end. + +atoms_in_erl_first_files_warning(Atoms) -> + W = "You have provided atoms as file entries in erl_first_files; " + "erl_first_files only expects lists of filenames as strings. " + "The following modules (~p) may not work as expected and it is advised " + "that you change these entires to string format " + "(e.g., \"src/module.erl\") ", + ?WARN(W, [Atoms]). |