From ae79184555445b43c8b6c7ff377c1e709f661391 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Wed, 3 Dec 2014 18:18:47 +0100 Subject: [PATCH] compiler and xref respect 'keep_going' flag --- src/rebar_base_compiler.erl | 26 +++++++++++++++++++++----- src/rebar_xref.erl | 7 ++++++- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl index d8569e7..c38fb11 100644 --- a/src/rebar_base_compiler.erl +++ b/src/rebar_base_compiler.erl @@ -152,11 +152,16 @@ compile_each([Unit | Rest], Config, CompileFn) -> skipped -> ?INFO("Skipped ~s\n", [unit_source(Unit)]); Error -> + maybe_report(Error), ?CONSOLE("Compiling ~s failed:\n", [maybe_absname(Config, unit_source(Unit))]), - maybe_report(Error), ?DEBUG("Compilation failed: ~p\n", [Error]), - ?FAIL + case rebar_config:get_xconf(Config, keep_going, false) of + false -> + ?FAIL; + true -> + ?WARN("Continuing after build error\n", []) + end end, compile_each(Rest, Config, CompileFn). @@ -180,11 +185,17 @@ compile_queue(Config, Pids, Targets) -> end; {fail, {_, {source, Source}}=Error} -> + maybe_report(Error), ?CONSOLE("Compiling ~s failed:\n", [maybe_absname(Config, Source)]), - maybe_report(Error), ?DEBUG("Worker compilation failed: ~p\n", [Error]), - ?FAIL; + case rebar_config:get_xconf(Config, keep_going, false) of + false -> + ?FAIL; + true -> + ?WARN("Continuing after build error\n", []), + compile_queue(Config, Pids, Targets) + end; {compiled, Unit, Warnings} -> report(Warnings), @@ -225,7 +236,12 @@ compile_worker(QueuePid, Config, CompileFn) -> compile_worker(QueuePid, Config, CompileFn); Error -> QueuePid ! {fail, {{error, Error}, {source, Source}}}, - ok + case rebar_config:get_xconf(Config, keep_going, false) of + false -> + ok; + true -> + compile_worker(QueuePid, Config, CompileFn) + end end; empty -> diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl index 0eb47c1..444134d 100644 --- a/src/rebar_xref.erl +++ b/src/rebar_xref.erl @@ -87,7 +87,12 @@ xref(Config, _) -> case lists:member(false, [XrefNoWarn, QueryNoWarn]) of true -> - ?FAIL; + case rebar_config:get_xconf(Config, keep_going, false) of + false -> + ?FAIL; + true -> + ok + end; false -> ok end.