瀏覽代碼

Tidy up "Linking.." messages during compile

Linking message will only be printed the first time the link or copy
actually happens.

Note:

rebar_file_utils:symlink_or_copy will now return 'exists'
instead of ok, if it did nothing because the link exists.

Nothing was checking the return value yet, so seemed reasonable.
pull/635/head
Richard Jones 9 年之前
父節點
當前提交
9263b95f82
共有 2 個檔案被更改,包括 18 行新增6 行删除
  1. +1
    -1
      src/rebar_file_utils.erl
  2. +17
    -5
      src/rebar_prv_install_deps.erl

+ 1
- 1
src/rebar_file_utils.erl 查看文件

@ -73,7 +73,7 @@ symlink_or_copy(Source, Target) ->
ok -> ok ->
ok; ok;
{error, eexist} -> {error, eexist} ->
ok;
exists;
{error, _} -> {error, _} ->
case os:type() of case os:type() of
{win32, _} -> {win32, _} ->

+ 17
- 5
src/rebar_prv_install_deps.erl 查看文件

@ -449,17 +449,29 @@ maybe_symlink_default(State, Profile, AppDir, AppInfo) ->
true -> true ->
SymDir = filename:join([rebar_dir:deps_dir(State), SymDir = filename:join([rebar_dir:deps_dir(State),
rebar_app_info:name(AppInfo)]), rebar_app_info:name(AppInfo)]),
symlink_dep(AppDir, SymDir),
symlink_dep(State, AppDir, SymDir),
true; true;
false -> false ->
false false
end. end.
symlink_dep(From, To) ->
?INFO("Linking ~s to ~s", [From, To]),
symlink_dep(State, From, To) ->
filelib:ensure_dir(To), filelib:ensure_dir(To),
rebar_file_utils:symlink_or_copy(From, To).
case rebar_file_utils:symlink_or_copy(From, To) of
ok ->
RelativeFrom = make_relative_to_root(State, From),
RelativeTo = make_relative_to_root(State, To),
?INFO("Linking ~s to ~s", [RelativeFrom, RelativeTo]),
ok;
exists ->
ok
end.
make_relative_to_root(State, Path) when is_binary(Path) ->
make_relative_to_root(State, binary_to_list(Path));
make_relative_to_root(State, Path) when is_list(Path) ->
Root = rebar_dir:root_dir(State),
rebar_dir:make_relative_path(Path, Root).
-spec parse_deps(binary(), list(), rebar_state:t(), list(), integer()) -> {[rebar_app_info:t()], [pkg_dep()]}. -spec parse_deps(binary(), list(), rebar_state:t(), list(), integer()) -> {[rebar_app_info:t()], [pkg_dep()]}.
parse_deps(DepsDir, Deps, State, Locks, Level) -> parse_deps(DepsDir, Deps, State, Locks, Level) ->

Loading…
取消
儲存