From f9b73b5d7ac3674b5830f5fc26cf6003ef652d66 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 5 Nov 2014 20:45:18 -0600 Subject: properly reset cwd after finding version of git resource --- include/rebar.hrl | 1 + src/rebar_git_resource.erl | 2 +- src/rebar_prv_common_test.erl | 5 +++++ src/rebar_prv_test_deps.erl | 2 -- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/rebar.hrl b/include/rebar.hrl index bae974d..701e8ed 100644 --- a/include/rebar.hrl +++ b/include/rebar.hrl @@ -16,6 +16,7 @@ -define(DEFAULT_LIB_DIRS, ["_checkouts", "apps", "libs", "."]). -define(DEFAULT_DEPS_DIR, "_deps"). -define(DEFAULT_PLUGINS_DIR, "_plugins"). +-define(DEFAULT_TEST_DEPS_DIR, "_tdeps"). -define(DEFAULT_CONFIG_FILE, "rebar.config"). -define(LOCK_FILE, "rebar.lock"). diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 6b655de..1c4ece7 100644 --- a/src/rebar_git_resource.erl +++ b/src/rebar_git_resource.erl @@ -84,7 +84,7 @@ download(Dir, {git, Url, Rev}) -> rebar_utils:sh(?FMT("git checkout -q ~s", [Rev]), [{cd, Dir}]). make_vsn(Dir) -> - Cwd = file:get_cwd(), + {ok, Cwd} = file:get_cwd(), try ok = file:set_cwd(Dir), {Vsn, RawRef, RawCount} = collect_default_refcount(), diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index b439977..ce63192 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -34,6 +34,7 @@ init(State) -> -spec do(rebar_state:t()) -> {ok, rebar_state:t()}. do(State) -> Opts = build_options(State), + expand_test_deps(filename:absname(rebar_state:get(State, test_deps_dir, ?DEFAULT_TEST_DEPS_DIR))), ct:run_test(Opts), {ok, State}. @@ -41,6 +42,10 @@ do(State) -> format_error(Reason, State) -> {io_lib:format("~p", [Reason]), State}. +expand_test_deps(Dir) -> + Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])), + ok = code:add_pathsa(Apps). + ct_opts(State) -> DefaultTestDir = filename:join([rebar_state:dir(State), "test"]), DefaultLogsDir = filename:join([rebar_state:dir(State), "logs"]), diff --git a/src/rebar_prv_test_deps.erl b/src/rebar_prv_test_deps.erl index a51f635..c9cd127 100644 --- a/src/rebar_prv_test_deps.erl +++ b/src/rebar_prv_test_deps.erl @@ -11,8 +11,6 @@ -define(PROVIDER, test_deps). -define(DEPS, []). --define(DEFAULT_TEST_DEPS_DIR, "_tdeps"). - %% =================================================================== %% Public API %% =================================================================== -- cgit v1.1