From e3d2142df51f50cc79797d3950f75e7d77a37a82 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 22 Nov 2013 15:23:54 +0000 Subject: Local corrections on string processing: * Corrected regexp: `[x|y]` -> `[xy]`. * Used an re:replace/4 option instead of multiple IOlist functions. --- src/rebar_erlc_compiler.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 5f541d9..1de9cb2 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -119,8 +119,7 @@ clean(Config, _AppFile) -> YrlFiles = rebar_utils:find_files("src", "^.*\\.[x|y]rl\$"), rebar_file_utils:delete_each( - [ binary_to_list(iolist_to_binary(re:replace(F, "\\.[x|y]rl$", ".erl"))) - || F <- YrlFiles ]), + [re:replace(F, "\\.[xy]rl$", ".erl", [{return,list}]) || F <- YrlFiles]), %% Delete the build graph, if any rebar_file_utils:rm_rf(erlcinfo_file(Config)), -- cgit v1.1 From 258ab8a62330e1a86bdd0e45e386218f25005c35 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 13 Jun 2014 14:29:54 +0200 Subject: Rebasing. Fix differences with c26b0c7 c996e98 b690842. --- src/rebar_erlc_compiler.erl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 1de9cb2..16a7a35 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -148,11 +148,9 @@ test_compile(Config, Cmd, OutDir) -> %% in src but in a subdirectory of src. Cover only looks in cwd and ../src %% for source files. Also copy files from src_dirs. SrcDirs = rebar_utils:src_dirs(proplists:append_values(src_dirs, ErlOpts1)), - SrcErls = lists:foldl( - fun(Dir, Acc) -> - Files = rebar_utils:find_files(Dir, ".*\\.erl\$"), - lists:append(Acc, Files) - end, [], SrcDirs), + SrcErls = lists:flatmap( + fun (Dir) -> rebar_utils:find_files(Dir, ".*\\.erl$") end, + SrcDirs), %% 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 @@ -163,17 +161,17 @@ test_compile(Config, Cmd, OutDir) -> %% rebar_file_utils:cp_r. %% Get the full path to a file that was previously copied in OutDir - ToCleanUp = fun(F, Acc) -> + ToCleanUp = fun(F) -> F2 = filename:basename(F), F3 = filename:join([OutDir, F2]), case filelib:is_regular(F3) of - true -> [F3|Acc]; - false -> Acc + true -> F3; + false -> [] end end, - ok = rebar_file_utils:delete_each(lists:foldl(ToCleanUp, [], TestErls)), - ok = rebar_file_utils:delete_each(lists:foldl(ToCleanUp, [], SrcErls)), + ok = rebar_file_utils:delete_each(lists:flatmap(ToCleanUp, TestErls)), + ok = rebar_file_utils:delete_each(lists:flatmap(ToCleanUp, SrcErls)), ok = rebar_file_utils:cp_r(SrcErls ++ TestErls, OutDir), -- cgit v1.1