Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/rlx_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
to_state(Config) ->
to_state(Config, rlx_state:new()).

to_state(Config, State) ->
to_state(Config0, State) ->
%% ensure 'mode' elements are at the head of the Config list,
%% this makes it possible to override options the modes expand
Modes = [V || {mode, _} = V <- Config0],
Config = Modes ++ (Config0 -- Modes),
%% setup warnings_as_errors before loading the rest so we can error on
%% any warning during the load
State1 = rlx_state:warnings_as_errors(State, proplists:get_bool(warnings_as_errors, Config)),
Expand Down
24 changes: 20 additions & 4 deletions test/rlx_release_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,9 @@ make_prod_mode_release(Config) ->
VmArgs = filename:join([LibDir1, "config", "vm.args"]),
rlx_file_utils:write(VmArgs, ""),

RelxConfig = [{mode, prod},
%% osx test fails if debug_info is strip
RelxConfig = [%% osx test fails if debug_info is strip
{debug_info, keep},
{mode, prod},
{sys_config, SysConfig},
{vm_args, VmArgs},
{release, {foo, "0.0.1"},
Expand All @@ -1295,6 +1295,10 @@ make_prod_mode_release(Config) ->
{output_dir, OutputDir} | RelxConfig]),

[{{foo, "0.0.1"}, _Release}] = maps:to_list(rlx_state:realized_releases(State)),

?assert(has_debug_info(filename:join([OutputDir, "foo", "lib",
"non_goal_1-0.0.1", "ebin",
"a_real_beamnon_goal_1.beam"]))),

case os:type() of
{unix, _} ->
Expand Down Expand Up @@ -1329,9 +1333,9 @@ make_minimal_mode_release(Config) ->
VmArgs = filename:join([LibDir1, "config", "vm.args"]),
rlx_file_utils:write(VmArgs, ""),

RelxConfig = [{mode, minimal},
%% osx test fails if debug_info is strip
RelxConfig = [%% osx test fails if debug_info is strip
{debug_info, keep},
{mode, minimal},
{sys_config, SysConfig},
{vm_args, VmArgs},
{release, {foo, "0.0.1"},
Expand All @@ -1343,6 +1347,10 @@ make_minimal_mode_release(Config) ->
{output_dir, OutputDir} | RelxConfig]),

[{{foo, "0.0.1"}, _Release}] = maps:to_list(rlx_state:realized_releases(State)),

?assert(has_debug_info(filename:join([OutputDir, "foo", "lib",
"non_goal_1-0.0.1", "ebin",
"a_real_beamnon_goal_1.beam"]))),

case os:type() of
{unix, _} ->
Expand Down Expand Up @@ -1370,3 +1378,11 @@ make_minimal_mode_release(Config) ->
%%%===================================================================
%%% Helper Functions
%%%===================================================================
has_debug_info(BeamFile) ->
{ok, Bin} = file:read_file(BeamFile),
case beam_lib:chunks(Bin, [debug_info]) of
{ok, _} ->
true;
_ ->
false
end.
Loading