diff options
Diffstat (limited to 'src/rebar_lfe_compiler.erl')
-rw-r--r-- | src/rebar_lfe_compiler.erl | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index b100e3d..06b0f08 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -41,27 +41,40 @@ 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( - <<"~n===============================================~n" - " You need to install LFE to compile LFE source files~n" - "Download the latest tarball release from github~n" - " https://github.com/rvirding/lfe/downloads~n" - " and install it into your erlang library dir~n" - "===============================================~n~n">>, []), + ?CONSOLE(<< + "~n" + "*** MISSING LFE COMPILER ***~n" + " You must do one of the following:~n" + " a) Install LFE globally in your erl libs~n" + " b) Add LFE as a dep for your project, eg:~n" + " {lfe, \"0.6.1\",~n" + " {git, \"git://github.com/rvirding/lfe\",~n" + " {tag, \"v0.6.1\"}}}~n" + "~n" + >>, []), ?FAIL; _ -> Opts = [{i, "include"}, {outdir, "ebin"}, report, return] ++ rebar_config:get_list(Config, lfe_opts, []), - case lfe_comp:file(Source,Opts) of - {ok, _, []} -> ok; - _ -> ?FAIL + case lfe_comp:file(Source, Opts) of + {ok, _, []} -> + ok; + {ok, _, _Warnings} -> + case lists:member(fail_on_warning, Opts) of + true -> + ok = file:delete(Target), + ?FAIL; + false -> + ok + end; + _ -> + ?FAIL end end. |