From 837192e34e07dbd1aeea9b2a380b56493bccba7b Mon Sep 17 00:00:00 2001 From: Mihai Balea Date: Wed, 1 Dec 2010 15:44:37 +0100 Subject: Fix compilation of *_first_files - Check the existence of first_files and fail if they are not present - Get first_files lists from local instead of inherited config definitions, since they only make sense in the local context --- src/rebar_erlc_compiler.erl | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index ef56bf4..e69dea9 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -57,15 +57,19 @@ -spec compile(Config::#config{}, AppFile::string()) -> 'ok'. compile(Config, _AppFile) -> rebar_base_compiler:run(Config, - rebar_config:get_list(Config, xrl_first_files, []), + check_files(rebar_config:get_local(Config, + xrl_first_files, [])), "src", ".xrl", "src", ".erl", fun compile_xrl/3), rebar_base_compiler:run(Config, - rebar_config:get_list(Config, yrl_first_files, []), + check_files(rebar_config:get_local(Config, + yrl_first_files, [])), "src", ".yrl", "src", ".erl", fun compile_yrl/3), doterl_compile(Config, "ebin"), - rebar_base_compiler:run(Config, rebar_config:get_list(Config, mib_first_files, []), + rebar_base_compiler:run(Config, + check_files(rebar_config:get_local(Config, + mib_first_files, [])), "mibs", ".mib", "priv/mibs", ".bin", fun compile_mib/3). @@ -355,3 +359,16 @@ filter_defines([{platform_define, ArchRegex, Key, Value} | Rest], Acc) -> end; filter_defines([Opt | Rest], Acc) -> filter_defines(Rest, [Opt | Acc]). + +%% +%% Ensure all files in a list are present and abort if one is missing +%% +-spec check_files(FileList::[string()]) -> [string()]. +check_files(FileList) -> + [check_file(F) || F <- FileList]. + +check_file(File) -> + case filelib:is_regular(File) of + false -> ?ABORT("File ~p is missing, aborting\n", [File]); + true -> File + end. -- cgit v1.1