diff options
author | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-03-05 14:11:31 +0300 |
---|---|---|
committer | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-03-05 14:11:31 +0300 |
commit | 7c40d624dc344e534c7b576341463648091f56e8 (patch) | |
tree | 4b384980bd6fe327cdecf25c55a6dd2622cd8412 /src/rebar_lfe_compiler.erl | |
parent | 48d23b90acb688a68354b20a1b19fa0aa0e592be (diff) | |
parent | 25c0226ab94560c5e182944c4c71b9f71ac3f08e (diff) |
Merge commit 'upstream/master'
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. |