From 7d6f04b42fa7b6c48eecf47c3bd964b867af696b Mon Sep 17 00:00:00 2001 From: Russell Brown Date: Sat, 12 Jun 2010 21:55:58 +0100 Subject: Stuffed in a global for deps dir. *If* there is a deps_dir tuple in the root rebar.config then that is used globally as the deps dir. This is to stop dependencies for dependencies being created in a different deps_dir even if the sub dependency so specifies. --- src/rebar_deps.erl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 08f2f54..89f6ffc 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -46,6 +46,11 @@ %% =================================================================== preprocess(Config, _) -> + %% Side effect to set deps_dir globally for all dependencies from top level down. + %% Means the root deps_dir is honoured or the default used globally + %% since it will be set on the first time through here + set_global_deps_dir(Config, rebar_config:get_global(deps_dir, [])), + %% Get the list of deps for the current working directory and identify those %% deps that are available/present. Deps = rebar_config:get_local(Config, deps, []), @@ -62,7 +67,7 @@ preprocess(Config, _) -> false -> %% Return all the available dep directories for process {ok, [D#dep.dir || D <- AvailableDeps]}; - _ -> + _ -> {ok, []} end. @@ -118,9 +123,18 @@ compile(Config, AppFile) -> %% Internal functions %% =================================================================== +%% Added because of trans deps, +%% need all deps in same dir and should be the one set by the root rebar.config +%% Sets a default if root config has no deps_dir set +set_global_deps_dir(Config, []) -> + rebar_config:set_global(deps_dir, rebar_config:get_local(Config, deps_dir, "deps")); +set_global_deps_dir(_Config, _DepsDir) -> + ok. + get_deps_dir() -> BaseDir = rebar_config:get_global(base_dir, []), - filename:join(BaseDir, "deps"). + DepsDir = rebar_config:get_global(deps_dir, "deps"), + filename:join(BaseDir, DepsDir). update_deps_code_path([]) -> ok; -- cgit v1.1