From 75f8a772b0c3ff1e6e951e92eda4aeb5064fe6d3 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 28 Feb 2015 17:42:30 -0600 Subject: copy all files from ebin to build output ebin if exists --- src/rebar_prv_compile.erl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index 0c6f40b..3d952ab 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -71,7 +71,7 @@ build_app(State, AppInfo) -> AppDir = rebar_app_info:dir(AppInfo), OutDir = rebar_app_info:out_dir(AppInfo), - copy_app_dirs(rebar_app_info:name(AppInfo), AppDir, OutDir), + copy_app_dirs(AppDir, OutDir), S = case rebar_app_info:state(AppInfo) of undefined -> @@ -108,16 +108,17 @@ handle_args(State) -> Jobs = proplists:get_value(jobs, Args, ?DEFAULT_JOBS), {ok, rebar_state:set(State, jobs, Jobs)}. -copy_app_dirs(AppName, OldAppDir, AppDir) -> +copy_app_dirs(OldAppDir, AppDir) -> case ec_cnv:to_binary(filename:absname(OldAppDir)) =/= ec_cnv:to_binary(filename:absname(AppDir)) of true -> - Name = ec_cnv:to_list(AppName), - AppFile = filename:join([OldAppDir, "ebin", Name++".app"]), - case filelib:is_file(AppFile) of + EbinDir = filename:join([OldAppDir, "ebin"]), + %% copy all files from ebin if it exists + case filelib:is_dir(EbinDir) of true -> - file:copy(AppFile, - filename:join([AppDir, "ebin", Name++".app"])); + OutEbin = filename:join(AppDir, "ebin"), + filelib:ensure_dir(filename:join(OutEbin, "dummy.beam")), + rebar_file_utils:cp_r(filelib:wildcard(filename:join(EbinDir, "*")), OutEbin); false -> ok end, -- cgit v1.1