Skip to content

Commit

Permalink
Merge pull request #2711 from ferd/carry-relx-overlay-vars
Browse files Browse the repository at this point in the history
Properly carry overlay_vars settings for files in relx
  • Loading branch information
tsloughter authored May 27, 2022
2 parents e217913 + 5111f99 commit f934571
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/rebar_relx.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ do(Provider, State) ->
DefaultOutputDir = filename:join(rebar_dir:base_dir(State), ?DEFAULT_RELEASE_DIR),
RelxConfig1 = RelxMode ++ [output_dir(DefaultOutputDir, Opts),
{overlay_vars_values, ExtraOverlays},
{overlay_vars, [{base_dir, rebar_dir:base_dir(State)} | overlay_vars(Opts)]}
{overlay_vars, [{base_dir, rebar_dir:base_dir(State)} | overlay_vars(RelxConfig, Opts)]}
| merge_overlays(RelxConfig)],

Args = [include_erts, system_libs, vm_args, sys_config],
Expand Down Expand Up @@ -219,10 +219,9 @@ merge_overlays(Config) ->
NewOverlay = lists:flatmap(fun({overlay, Overlay}) -> Overlay end, lists:reverse(Overlays)),
[{overlay, NewOverlay} | Others].

overlay_vars(Opts) ->
case proplists:get_value(overlay_vars, Opts) of
undefined ->
[];
overlay_vars(RelxConfig, Opts) ->
case proplists:get_value(overlay_vars, Opts, []) ++
proplists:get_value(overlay_vars, RelxConfig, []) of
[] ->
[];
FileName when is_list(FileName) ->
Expand Down
3 changes: 1 addition & 2 deletions test/rebar_release_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,14 @@ profile_overlays(Config) ->
{copy, filename:join(AppDir,"./dev.file"), "{{env}}.file"},
{chmod, 8#00770, "profile.file"}]},
{lib_dirs, [AppDir]}]},
{profiles, [{prod,
{profiles, [{prod,
[{relx, [
{debug_info, keep},
{overlay_vars, filename:join(AppDir, "prod.vars")},
{overlay, [{mkdir, "otherrandomdir"},
{copy, filename:join(AppDir, "./prod.file"), "{{env}}.file"},
{copy, filename:join(AppDir, "./prod.file"), "profile.file"},
{chmod, 8#00770, "profile.file"}]}

]}]
}]}
])),
Expand Down

0 comments on commit f934571

Please sign in to comment.