erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

RELEASE compiling options for deps different from reltool #632

Closed c-bik closed 6 years ago

c-bik commented 6 years ago

Hi all,

This is more of a question than an issue. I couldn't think of a better place to ask this so here it is:

I am compiling/releasing an application with the following rebar.config:

{deps,
 [{jsx, {git, "https://github.com/talentdeficit/jsx", {tag, "v2.8.2"}}},
]}.
{recursive_cmds, [clean,eunit]}.
{erl_opts, [
  {parse_transform, lager_transform},
...
]}.
{relx, [
    {release, {xyz, {semver, ""}}, [xyz]},
    {dev_mode, true},
    {extended_start_script, true},
    {include_erts, true},
    {overlay_vars, "config/vars.config"},
    {overlay, [
        {copy, "LICENSE", "LICENSE"},
        {copy, "README.md", "README.md"},
...
    ]}
]}.

{xref_checks, [...]}.
{shell, [...]}.
{post_hooks, [...]}.
{profiles, [
    {prod, [
...
        {relx, [{dev_mode, false}]}
    ]}
]}.

When I create a release with rebar3 as prod release, in the erlang console I get:

> jsx_decoder:module_info(compile).
[{options,[debug_info,
           {d,maps_support},
           {i,"/home/.../_build/default/lib/jsx/src"},
           {i,"/home/.../_build/default/lib/jsx/include"},
           {i,"/home/.../_build/default/lib/jsx"}]},
...
 {source,"/home/.../_build/default/lib/jsx/src/jsx_decoder.erl"}]

However with old reltool it used to be:

> jsx_decoder:module_info(compile).
[{options,[{outdir,"ebin"},
           debug_info,
           {d,'RELEASE'},
           {d,maps_support},
           {i,"include"}]},
...
 {source,"/home/.../deps/jsx/src/jsx_decoder.erl"}]

Problem

In release deployment, in case of a stacktrace, I am seeing that relx builds are producing full path instead of relative path (as it used to be with reltool)

> try jsx:decode(a) catch _:_ -> erlang:get_stacktrace() end.
[{jsx_decoder,value,4,
              [{file,"/home/.../_build/default/lib/jsx/src/jsx_decoder.erl"},
               {line,234}]},
...
 {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]

as opposed to desired...

> try jsx:decode(a) catch _:_ -> erlang:get_stacktrace() end.
[{jsx_decoder,value,4,
              [{file,"src/jsx_decoder.erl"},{line,234}]},
...
 {shell,eval_loop,3,[{file,"shell.erl"},{line,626}]}]

Exposing full build path of a dev system doesn't look nice for a prod stacktrace (cosmetic).

My guess is, this is happening due to the missing {d,'RELEASE'}.

Please help/advice.

Thanks

ferd commented 6 years ago

This is being discussed in https://github.com/erlang/rebar3/pull/1695

c-bik commented 6 years ago

Thanks. Closing this, as it needs to addressed in rebar3