Browse Source

add checkouts out dir directory to rebar_dir and use it in app utils

pull/2276/head
Tristan Sloughter 5 years ago
parent
commit
2457d43576
No known key found for this signature in database GPG Key ID: AAB97DDECCEB8150
3 changed files with 15 additions and 1 deletions
  1. +1
    -0
      src/rebar.hrl
  2. +1
    -1
      src/rebar_app_utils.erl
  3. +13
    -0
      src/rebar_dir.erl

+ 1
- 0
src/rebar.hrl View File

@ -18,6 +18,7 @@
-define(DEFAULT_ROOT_DIR, ".").
-define(DEFAULT_PROJECT_APP_DIRS, ["apps/*", "lib/*", "."]).
-define(DEFAULT_CHECKOUTS_DIR, "_checkouts").
-define(DEFAULT_CHECKOUTS_OUT_DIR, "checkouts").
-define(DEFAULT_DEPS_DIR, "lib").
-define(DEFAULT_PLUGINS_DIR, "plugins").
-define(DEFAULT_TEST_DEPS_DIR, "test/lib").

+ 1
- 1
src/rebar_app_utils.erl View File

@ -255,7 +255,7 @@ dep_to_app(Parent, DepsDir, Name, Vsn, Source, IsLock, State) ->
CheckoutsDir = rebar_utils:to_list(rebar_dir:checkouts_dir(State, Name)),
AppInfo = case rebar_app_info:discover(CheckoutsDir) of
{ok, App} ->
OutDir = filename:join([DepsDir, "..", "checkouts", Name]),
OutDir = filename:join(rebar_dir:checkouts_out_dir(State), Name),
rebar_app_info:out_dir(
rebar_app_info:source(
rebar_app_info:is_checkout(App, true), checkout), OutDir);

+ 13
- 0
src/rebar_dir.erl View File

@ -9,6 +9,8 @@
root_dir/1,
checkouts_dir/1,
checkouts_dir/2,
checkouts_out_dir/1,
checkouts_out_dir/2,
plugins_dir/1,
lib_dirs/1,
home_dir/0,
@ -97,6 +99,17 @@ checkouts_dir(State) ->
checkouts_dir(State, App) ->
filename:join(checkouts_dir(State), App).
%% @doc returns the location of the directory checkouts are built to
-spec checkouts_out_dir(rebar_state:t()) -> file:filename_all().
checkouts_out_dir(State) ->
filename:join(base_dir(State), rebar_state:get(State, checkouts_out_dir, ?DEFAULT_CHECKOUTS_OUT_DIR)).
%% @doc returns the expected location of a given app in the checkouts
%% directory for the project.
-spec checkouts_out_dir(rebar_state:t(), file:filename_all()) -> file:filename_all().
checkouts_out_dir(State, App) ->
filename:join(checkouts_out_dir(State), App).
%% @doc Returns the directory where plugins are located.
-spec plugins_dir(rebar_state:t()) -> file:filename_all().
plugins_dir(State) ->

Loading…
Cancel
Save