diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-02-28 17:42:30 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-02-28 17:42:30 -0600 |
commit | 75f8a772b0c3ff1e6e951e92eda4aeb5064fe6d3 (patch) | |
tree | 835bd79d8b818ae8548ef45f6e30df05ba2296ad | |
parent | 9fc885073b4772f646d39fc5ba257c34f0b05742 (diff) |
copy all files from ebin to build output ebin if exists
-rw-r--r-- | src/rebar_prv_compile.erl | 15 |
1 files changed, 8 insertions, 7 deletions
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, |