rebar3
rebar3 copied to clipboard
relx opt should not sort
relx options should not be sort, otherwise, the right override strategy will not work.
This can't be accepted without tests at least showing the behaviour you wish to change
Yea, and I'd be surprised if this was an accurate fix to your issue. I know we've had issues with sorting before but really thought at this point we had it right -- though certainly possible that the relx 4.0 changes could have messed something up.
So you may want to provide an example of your config you are having issues with before writing tests, so we can go over it and make sure this is the right direction.
With the example of this page
You can override options that the modes expand to by including explicit setting them. For example, if you did want to keep the debug info in the BEAM modules then you can use a configuration like:
[
{mode, prod},
{debug_info, keep}
]
Create a new release with simple rebar.config
{erl_opts, [debug_info]}.
{deps, []}.
{relx, [{release, {rlex_test, "0.1.0"},
[rlex_test,
sasl]},
{mode, dev},
%% automatically picked up if the files
%% exist but can be set manually, which
%% is required if the names aren't exactly
%% sys.config and vm.args
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"}
%% the .src form of the configuration files do
%% not require setting RELX_REPLACE_OS_VARS
%% {sys_config_src, "./config/sys.config.src"},
%% {vm_args_src, "./config/vm.args.src"}
]}.
{profiles, [{prod, [{relx,
[%% prod is the default mode when prod
%% profile is used, so does not have
%% to be explicitly included like this
{mode, prod},
{debug_info, keep}
%% use minimal mode to exclude ERTS
%% {mode, minimal}
]
}]}]}.
If sort opts, the reabr3 as prod release
final RelxState is
{state_t,"/home/dual/learn/rlex_test",
"/home/dual/learn/rlex_test/_build/prod/rel",[],[],#{},
"/home/dual/learn/rlex_test/config/vm.args",undefined,
"/home/dual/learn/rlex_test/config/sys.config",undefined,[],[],[],
strip,
#{{rlex_test,"0.1.0"} =>
{release_t,rlex_test,"0.1.0",undefined,
[{rlex_test,#{included_applications => undefined,
name => rlex_test,type => undefined,
vsn => undefined}},
{sasl,#{included_applications => undefined,
name => sasl,type => undefined,
vsn => undefined}}],
false,[],[],undefined,[]}},
#{},false,true,true,undefined,false,true,true,false,[],true,
[{profile_string,"prod"}],
[{base_dir,"/home/dual/learn/rlex_test/_build/prod"}],
true,[],[],true,undefined,false,prod,true}
and the debug_info option is ===> rlx_state:debug_info(RelxState):strip
. It's not work as the doc say.