rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

remove useless code

Open DualHappiness opened this issue 3 years ago • 1 comments

The mode automatic mode prod always override by default mode dev, so the code is useless.

DualHappiness avatar Feb 07 '21 09:02 DualHappiness

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, []}]}.

As the document says, When building in the rebar3 prod profile, like with rebar3 as prod release then the relx prod mode is enabled automatically., but the prod mode is added to the most left side of the RelxConfig and because the default relx config is common with a {mode, dev} part, the prod mode will yield. rebar3 as prod release 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,[],[],[],
         keep,
         #{{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,[]}},
         #{},true,false,true,undefined,false,true,true,false,[],true,
         [{profile_string,"prod"}],
         [{base_dir,"/home/dual/learn/rlex_test/_build/prod"}],
         true,[],[],true,undefined,false,dev,true}

The final mode is dev.

DualHappiness avatar Feb 20 '21 07:02 DualHappiness