소스 검색

make base_dir for a run include the profiles in path, link to shared deps

pull/195/head
Tristan Sloughter 10 년 전
부모
커밋
d4c2332aab
5개의 변경된 파일21개의 추가작업 그리고 7개의 파일을 삭제
  1. +0
    -1
      src/rebar.hrl
  2. +1
    -1
      src/rebar3.erl
  3. +4
    -1
      src/rebar_dir.erl
  4. +13
    -1
      src/rebar_prv_install_deps.erl
  5. +3
    -3
      test/rebar_test_utils.erl

+ 0
- 1
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").

+ 1
- 1
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)),

+ 4
- 1
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) ->

+ 13
- 1
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) ->

+ 3
- 3
test/rebar_test_utils.erl 파일 보기

@ -142,7 +142,7 @@ top_level_deps([{{Name, Vsn, Ref}, _} | Deps]) ->
%%% Helpers %%%
%%%%%%%%%%%%%%%
check_results(AppDir, Expected) ->
BuildDir = filename:join([AppDir, "_build", "lib"]),
BuildDirs = filelib:wildcard(filename:join([AppDir, "_build", "*", "lib"])),
CheckoutsDir = filename:join([AppDir, "_checkouts"]),
LockFile = filename:join([AppDir, "rebar.lock"]),
Locks = lists:flatten(rebar_config:consult_file(LockFile)),
@ -152,7 +152,7 @@ check_results(AppDir, Expected) ->
AppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Apps],
InvalidAppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- InvalidApps],
ValidAppsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- ValidApps],
Deps = rebar_app_discover:find_apps([BuildDirspan>], all),
Deps = rebar_app_discover:find_apps(BuildDirs, all),
DepsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Deps],
Checkouts = rebar_app_discover:find_apps([CheckoutsDir], all),
CheckoutsNames = [{ec_cnv:to_list(rebar_app_info:name(App)), App} || App <- Checkouts],
@ -217,7 +217,7 @@ check_results(AppDir, Expected) ->
{ok, Cwd} = file:get_cwd(),
try
file:set_cwd(AppDir),
ReleaseDir = filename:join([AppDir, "_build", "rel"]),
[ReleaseDir] = filelib:wildcard(filename:join([AppDir, "_build", "*", "rel"])),
RelxState = rlx_state:new("", [], []),
RelxState1 = rlx_state:base_output_dir(RelxState, ReleaseDir),
{ok, RelxState2} = rlx_prv_app_discover:do(RelxState1),

불러오는 중...
취소
저장