diff options
-rw-r--r-- | src/rlx_prv_app_discover.erl | 10 | ||||
-rw-r--r-- | test/rlx_release_SUITE.erl | 25 |
2 files changed, 25 insertions, 10 deletions
diff --git a/src/rlx_prv_app_discover.erl b/src/rlx_prv_app_discover.erl index 72cdea2..8e2bd24 100644 --- a/src/rlx_prv_app_discover.erl +++ b/src/rlx_prv_app_discover.erl @@ -80,9 +80,17 @@ get_lib_dirs(State) -> false -> LibDirs0; true -> + Output = erlang:iolist_to_binary(rlx_state:base_output_dir(State)), + OutputDir = case ec_file:exists(binary_to_list(Output)) of + true -> + Output; + false -> + [] + end, lists:flatten([LibDirs0, add_common_project_dirs(State), - add_system_lib_dir(State)]) + add_system_lib_dir(State), + OutputDir]) end. -spec add_common_project_dirs(rlx_state:t()) -> [file:name()]. diff --git a/test/rlx_release_SUITE.erl b/test/rlx_release_SUITE.erl index 112afc8..6ae4f24 100644 --- a/test/rlx_release_SUITE.erl +++ b/test/rlx_release_SUITE.erl @@ -737,9 +737,16 @@ make_relup_release(Config) -> OutputDir = filename:join([proplists:get_value(data_dir, Config), create_random_name("relx-output")]), {ok, _} = relx:do(foo, "0.0.1", [], [LibDir1], 3, - OutputDir, ConfigFile), + OutputDir, ConfigFile), + {ok, _} = relx:do(foo, "0.0.2", [], [LibDir1], 3, - OutputDir, ConfigFile), + OutputDir, ConfigFile), + + %% Goal apps are removed to simulate a users dev environment where the apps + %% being used in an appup/relup are likely only under _rel/<release>/lib/ + ec_file:remove(filename:join(LibDir1, "goal_app_1-0.0.1"), [recursive]), + ec_file:remove(filename:join(LibDir1, "goal_app_1-0.0.2"), [recursive]), + {ok, State} = relx:do([{relname, foo}, {relvsn, "0.0.3"}, {goals, []}, @@ -821,13 +828,13 @@ make_relup_release2(Config) -> {ok, _} = relx:do(foo, "0.0.2", [], [LibDir1], 3, OutputDir, ConfigFile), {ok, State} = relx:do([{relname, foo}, - {relvsn, "0.0.3"}, - {upfrom, "0.0.1"}, - {goals, []}, - {lib_dirs, [LibDir1]}, - {log_level, 3}, - {output_dir, OutputDir}, - {config, ConfigFile}], ["release", "relup"]), + {relvsn, "0.0.3"}, + {upfrom, "0.0.1"}, + {goals, []}, + {lib_dirs, [LibDir1]}, + {log_level, 3}, + {output_dir, OutputDir}, + {config, ConfigFile}], ["release", "relup"]), %% we should have one 'resolved' release and three discovered realized_releases. ?assertMatch([{foo, "0.0.1"}, |