summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Balea <mihai.balea@corp.singlesnet.com>2010-12-01 15:44:37 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2010-12-01 17:30:23 +0100
commit837192e34e07dbd1aeea9b2a380b56493bccba7b (patch)
treefc7118c4e39816186d1e8edd340325aa7fdf348a
parentb4b97c36603665d44e31c102e1fa53a82a34afe4 (diff)
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
-rw-r--r--src/rebar_erlc_compiler.erl23
1 files 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.