summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rebar.hrl1
-rw-r--r--src/rebar3.erl2
-rw-r--r--src/rebar_dir.erl5
-rw-r--r--src/rebar_prv_install_deps.erl14
4 files changed, 18 insertions, 4 deletions
diff --git a/src/rebar.hrl b/src/rebar.hrl
index bbd9a2f..0dfcad0 100644
--- a/src/rebar.hrl
+++ b/src/rebar.hrl
@@ -14,7 +14,6 @@
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
-define(DEFAULT_BASE_DIR, "_build").
--define(DEFAULT_PROFILE_DIR, "default").
-define(DEFAULT_PROJECT_APP_DIRS, ["_checkouts", "apps", "lib", "."]).
-define(DEFAULT_DEPS_DIR, "lib").
-define(DEFAULT_PLUGINS_DIR, "plugins").
diff --git a/src/rebar3.erl b/src/rebar3.erl
index bd52fee..d7597cd 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -120,7 +120,7 @@ run_aux(State, GlobalPluginProviders, RawArgs) ->
end,
%% Process each command, resetting any state between each one
- BaseDir = rebar_dir:base_dir(State2),
+ BaseDir = rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR),
State3 = rebar_state:set(State2, base_dir,
filename:join(filename:absname(rebar_state:dir(State2)), BaseDir)),
diff --git a/src/rebar_dir.erl b/src/rebar_dir.erl
index 3962bf8..388b4c6 100644
--- a/src/rebar_dir.erl
+++ b/src/rebar_dir.erl
@@ -23,7 +23,10 @@
-spec base_dir(rebar_state:t()) -> file:filename_all().
base_dir(State) ->
- rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR).
+ Profiles = rebar_state:current_profiles(State),
+ ProfilesStrings = [ec_cnv:to_list(P) || P <- Profiles],
+ ProfilesDir = string:join(ProfilesStrings, "+"),
+ filename:join(rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), ProfilesDir).
-spec deps_dir(rebar_state:t()) -> file:filename_all().
deps_dir(State) ->
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index ab4cca1..952043e 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -374,7 +374,15 @@ maybe_fetch(AppInfo, Upgrade, Seen, State) ->
false ->
case rebar_app_discover:find_app(AppDir, all) of
false ->
- fetch_app(AppInfo, AppDir, State);
+ case in_default(AppInfo, State) of
+ false ->
+ fetch_app(AppInfo, AppDir, State);
+ {true, FoundApp} ->
+ ?INFO("Linking ~s to ~s", [rebar_app_info:dir(FoundApp), AppDir]),
+ filelib:ensure_dir(AppDir),
+ ok = file:make_symlink(rebar_app_info:dir(FoundApp), AppDir),
+ true
+ end;
{true, _} ->
case sets:is_element(rebar_app_info:name(AppInfo), Seen) of
true ->
@@ -392,6 +400,10 @@ in_checkouts(AppInfo) ->
error -> false
end.
+in_default(AppInfo, State) ->
+ Name = ec_cnv:to_list(rebar_app_info:name(AppInfo)),
+ DefaultAppDir = filename:join([rebar_state:get(State, base_dir), "default", "lib", Name]),
+ rebar_app_discover:find_app(DefaultAppDir, all).
-spec parse_deps(binary(), list(), list(), list(), integer()) -> {[rebar_app_info:t()], [pkg_dep()]}.
parse_deps(DepsDir, Deps, State, Locks, Level) ->