summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Brown <russell.brown@mac.com>2010-06-12 21:55:58 +0100
committerRussell Brown <russell.brown@mac.com>2010-06-12 21:55:58 +0100
commit7d6f04b42fa7b6c48eecf47c3bd964b867af696b (patch)
treef449d5eb3e3b284e032297c381c8eb3b206bd5ec
parent952b838d723625d131e2b736a1d1737d358c72af (diff)
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.
-rw-r--r--src/rebar_deps.erl18
1 files changed, 16 insertions, 2 deletions
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;