From 5111f9925b7d78eb8c7b37c35057f952ef0451f9 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Thu, 26 May 2022 20:34:50 +0000 Subject: [PATCH] Properly carry overlay_vars settings for files in relx --- src/rebar_relx.erl | 9 ++++----- test/rebar_release_SUITE.erl | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/rebar_relx.erl b/src/rebar_relx.erl index 913fcb573..bfb4674d0 100644 --- a/src/rebar_relx.erl +++ b/src/rebar_relx.erl @@ -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], @@ -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) -> diff --git a/test/rebar_release_SUITE.erl b/test/rebar_release_SUITE.erl index 0844bafe2..a793317f3 100644 --- a/test/rebar_release_SUITE.erl +++ b/test/rebar_release_SUITE.erl @@ -242,7 +242,7 @@ 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")}, @@ -250,7 +250,6 @@ profile_overlays(Config) -> {copy, filename:join(AppDir, "./prod.file"), "{{env}}.file"}, {copy, filename:join(AppDir, "./prod.file"), "profile.file"}, {chmod, 8#00770, "profile.file"}]} - ]}] }]} ])),