From 5049da8ec4a1db76b13bf081a2d489fdb15a4775 Mon Sep 17 00:00:00 2001 From: Tim Dysinger Date: Sun, 20 Feb 2011 13:52:22 -1000 Subject: Add fail_on_warning support for LFE --- src/rebar_lfe_compiler.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/rebar_lfe_compiler.erl') 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. -- cgit v1.1 From 6f97e6e55bc36b0c2960f4854a43787275236add Mon Sep 17 00:00:00 2001 From: Tim Dysinger Date: Sun, 20 Feb 2011 14:05:13 -1000 Subject: Add up to date instructions in case LFE is missing --- src/rebar_lfe_compiler.erl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/rebar_lfe_compiler.erl') diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index 6ea0724..95d2e84 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -48,13 +48,17 @@ compile(Config, _AppFile) -> 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] ++ -- cgit v1.1 From c6f6e8a572fe4760aaa9d36d77ab2b9209534054 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Mon, 21 Feb 2011 15:36:50 +0100 Subject: Fix Dialyzer warning and slightly reformat code --- src/rebar_lfe_compiler.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/rebar_lfe_compiler.erl') diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index 95d2e84..dc97bb1 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -64,11 +64,15 @@ compile_lfe(Source, Target, Config) -> Opts = [{i, "include"}, {outdir, "ebin"}, report, return] ++ rebar_config:get_list(Config, erl_opts, []), case lfe_comp:file(Source, Opts) of - {ok, _, []} -> ok; + {ok, _, []} -> + ok; {ok, _, _Warnings} -> case lists:member(fail_on_warning, Opts) of - true -> file:delete(Target), ?FAIL; - false -> ok + true -> + ok = file:delete(Target), + ?FAIL; + false -> + ok end; _ -> ?FAIL end -- cgit v1.1 From 2cff499a342f5bcb978e88fd453764afac6d5817 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 22 Feb 2011 15:46:34 +0100 Subject: Fix regression in rebar_lfe_compiler --- src/rebar_lfe_compiler.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/rebar_lfe_compiler.erl') diff --git a/src/rebar_lfe_compiler.erl b/src/rebar_lfe_compiler.erl index dc97bb1..06b0f08 100644 --- a/src/rebar_lfe_compiler.erl +++ b/src/rebar_lfe_compiler.erl @@ -62,7 +62,7 @@ compile_lfe(Source, Target, Config) -> ?FAIL; _ -> Opts = [{i, "include"}, {outdir, "ebin"}, report, return] ++ - rebar_config:get_list(Config, erl_opts, []), + rebar_config:get_list(Config, lfe_opts, []), case lfe_comp:file(Source, Opts) of {ok, _, []} -> ok; @@ -74,6 +74,7 @@ compile_lfe(Source, Target, Config) -> false -> ok end; - _ -> ?FAIL + _ -> + ?FAIL end end. -- cgit v1.1