diff options
author | Tim Dysinger <tim@dysinger.net> | 2011-02-20 13:52:22 -1000 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-02-21 15:29:25 +0100 |
commit | 5049da8ec4a1db76b13bf081a2d489fdb15a4775 (patch) | |
tree | f4ddca02cf7df68254adb466af4a2a928291640b | |
parent | 3db8f585f11eb7d7a9573d9f3a5480f6a900e6d7 (diff) |
Add fail_on_warning support for LFE
-rw-r--r-- | src/rebar_lfe_compiler.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index b100e3d..6ea0724 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -41,12 +41,11 @@ compile(Config, _AppFile) -> rebar_base_compiler:run(Config, FirstFiles, "src", ".lfe", "ebin", ".beam", fun compile_lfe/3). - %% =================================================================== %% Internal functions %% =================================================================== -compile_lfe(Source, _Target, Config) -> +compile_lfe(Source, Target, Config) -> case code:which(lfe_comp) of non_existing -> ?CONSOLE( @@ -59,9 +58,14 @@ compile_lfe(Source, _Target, Config) -> ?FAIL; _ -> Opts = [{i, "include"}, {outdir, "ebin"}, report, return] ++ - rebar_config:get_list(Config, lfe_opts, []), - case lfe_comp:file(Source,Opts) of + rebar_config:get_list(Config, erl_opts, []), + case lfe_comp:file(Source, Opts) of {ok, _, []} -> ok; + {ok, _, _Warnings} -> + case lists:member(fail_on_warning, Opts) of + true -> file:delete(Target), ?FAIL; + false -> ok + end; _ -> ?FAIL end end. |