From c26b0c7d6b524289047c9a420d28bc1ab2110310 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 25 Feb 2014 21:07:56 +0100 Subject: [PATCH 1/2] erlc: fix comment test_compile/3 is used by eunit and qc, but the comment was only referring to 'rebar eunit'. --- src/rebar_erlc_compiler.erl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index a1740b0..9e41f2e 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -146,12 +146,13 @@ test_compile(Config, Cmd, OutDir) -> lists:append(Acc, Files) end, [], SrcDirs), - %% If it is not the first time rebar eunit is executed, there will be source - %% files already present in OutDir. Since some SCMs (like Perforce) set - %% the source files as being read only (unless they are checked out), we - %% need to be sure that the files already present in OutDir are writable - %% before doing the copy. This is done here by removing any file that was - %% already present before calling rebar_file_utils:cp_r. + %% If it is not the first time rebar eunit or rebar qc is executed, + %% there will be source files already present in OutDir. Since some + %% SCMs (like Perforce) set the source files as being read only (unless + %% they are checked out), we need to be sure that the files already + %% present in OutDir are writable before doing the copy. This is done + %% here by removing any file that was already present before calling + %% rebar_file_utils:cp_r. %% Get the full path to a file that was previously copied in OutDir ToCleanUp = fun(F, Acc) -> From 03fe5318c6cdc0a9eb1c0a9ee9d9267791ca4dda Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 25 Feb 2014 21:33:35 +0100 Subject: [PATCH 2/2] Fix #220 (Reported-by: Joseph Norton) When running 'rebar qc' or 'rebar eunit', we were erroneously fetching erl_opts more than once. --- src/rebar_erlc_compiler.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 9e41f2e..75d47fb 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -173,7 +173,7 @@ test_compile(Config, Cmd, OutDir) -> %% with appropriate defines for eunit, and include all the test modules %% as well. ok = doterl_compile(test_compile_config(Config, ErlOpts, Cmd), - OutDir, TestErls), + OutDir, TestErls, ErlOpts), {ok, SrcErls}. @@ -272,11 +272,11 @@ is_lib_avail(Config, DictKey, Mod, Hrl, Name) -> -spec doterl_compile(rebar_config:config(), file:filename()) -> 'ok'. doterl_compile(Config, OutDir) -> - doterl_compile(Config, OutDir, []). - -doterl_compile(Config, OutDir, MoreSources) -> - ErlFirstFiles = rebar_config:get_list(Config, erl_first_files, []), ErlOpts = rebar_utils:erl_opts(Config), + doterl_compile(Config, OutDir, [], ErlOpts). + +doterl_compile(Config, OutDir, MoreSources, ErlOpts) -> + ErlFirstFiles = rebar_config:get_list(Config, erl_first_files, []), ?DEBUG("erl_opts ~p~n", [ErlOpts]), %% Support the src_dirs option allowing multiple directories to %% contain erlang source. This might be used, for example, should