aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_prv_assembler.erl
diff options
context:
space:
mode:
authorJordan Wilberding <[email protected]>2014-11-06 14:41:25 -0800
committerJordan Wilberding <[email protected]>2014-11-06 14:41:25 -0800
commit638309914dd34e0ae3936fb4ed0cd4a2663ebde0 (patch)
treef0ad5f73fa83056f957969f0b2293c88c007910e /src/rlx_prv_assembler.erl
parentc603adf0a9e4b836c111a018bd5820d41c0a4e60 (diff)
parent9b066cc53e342f3928dfb01a3511e3869b18e2c0 (diff)
downloadrelx-638309914dd34e0ae3936fb4ed0cd4a2663ebde0.tar.gz
relx-638309914dd34e0ae3936fb4ed0cd4a2663ebde0.tar.bz2
relx-638309914dd34e0ae3936fb4ed0cd4a2663ebde0.zip
Merge pull request #259 from tsloughter/debug_info
add option to strip debug_info from beam files if not dev_mode
Diffstat (limited to 'src/rlx_prv_assembler.erl')
-rw-r--r--src/rlx_prv_assembler.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index c535485..622c99d 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -60,7 +60,23 @@ do(State) ->
ok ->
case rlx_release:realized(Release) of
true ->
- copy_app_directories_to_output(State, Release, OutputDir);
+ case copy_app_directories_to_output(State, Release, OutputDir) of
+ {ok, State1} ->
+ case rlx_state:debug_info(State1) =:= strip
+ andalso rlx_state:dev_mode(State1) =:= false of
+ true ->
+ case beam_lib:strip_release(OutputDir) of
+ {ok, _} ->
+ {ok, State1};
+ {error, _, Reason} ->
+ ?RLX_ERROR({strip_release, Reason})
+ end;
+ false ->
+ {ok, State1}
+ end;
+ E ->
+ E
+ end;
false ->
?RLX_ERROR({unresolved_release, RelName, RelVsn})
end;
@@ -95,7 +111,10 @@ format_error({release_script_generation_error, Module, Errors}, State) ->
format_error({unable_to_make_symlink, AppDir, TargetDir, Reason}, _) ->
io_lib:format("Unable to symlink directory ~s to ~s because \n~s~s",
[AppDir, TargetDir, rlx_util:indent(2),
- file:format_error(Reason)]).
+ file:format_error(Reason)]);
+format_error({strip_release, Reason}, _) ->
+ io_lib:format("Stripping debug info from release beam files failed becuase ~s",
+ [beam_lib:format_error(Reason)]).
%%%===================================================================
%%% Internal Functions