Browse Source

Reworking app discovery and dep fetching verbosity

Move most stuff that have to do with effectiveness to the debug
level, and some stuff that has to do with implementation details to
diagnostics
pull/2375/head
Fred Hebert 4 years ago
parent
commit
a2331633a7
5 changed files with 15 additions and 9 deletions
  1. +6
    -0
      src/rebar_app_discover.erl
  2. +1
    -1
      src/rebar_fetch.erl
  3. +4
    -4
      src/rebar_git_resource.erl
  4. +3
    -3
      src/rebar_pkg_resource.erl
  5. +1
    -1
      src/rebar_prv_install_deps.erl

+ 6
- 0
src/rebar_app_discover.erl View File

@ -31,6 +31,12 @@ do(State, LibDirs) ->
%% There may be a top level src which is an app and there may not %% There may be a top level src which is an app and there may not
%% Find it here if there is, otherwise define the deps parent as root %% Find it here if there is, otherwise define the deps parent as root
TopLevelApp = define_root_app(Apps, State), TopLevelApp = define_root_app(Apps, State),
?DEBUG("Found top-level apps: [~ts]~n\tusing config: ~p",
[case lists:flatten([[",",rebar_app_info:name(App)] || App <- Apps]) of
[] -> "";
Str -> tl(Str)
end,
[{src_dirs, SrcDirs}, {lib_dirs, LibDirs}]]),
%% Handle top level deps %% Handle top level deps
State1 = lists:foldl(fun(Profile, StateAcc) -> State1 = lists:foldl(fun(Profile, StateAcc) ->

+ 1
- 1
src/rebar_fetch.erl View File

@ -59,7 +59,7 @@ download_source_(AppInfo, State) ->
code:del_path(filename:absname(filename:join(AppDir1, "ebin"))), code:del_path(filename:absname(filename:join(AppDir1, "ebin"))),
FetchDir = rebar_app_info:fetch_dir(AppInfo), FetchDir = rebar_app_info:fetch_dir(AppInfo),
ok = rebar_file_utils:rm_rf(filename:absname(FetchDir)), ok = rebar_file_utils:rm_rf(filename:absname(FetchDir)),
?DEBUG("Moving checkout ~p to ~p", [TmpDir, filename:absname(FetchDir)]),
?DIAGNOSTIC("Moving checkout ~p to ~p", [TmpDir, filename:absname(FetchDir)]),
rebar_file_utils:mv(TmpDir, filename:absname(FetchDir)); rebar_file_utils:mv(TmpDir, filename:absname(FetchDir));
Error -> Error ->
Error Error

+ 4
- 4
src/rebar_git_resource.erl View File

@ -369,12 +369,12 @@ parse_tags(Dir) ->
git_clone_options() -> git_clone_options() ->
Option = case os:getenv("REBAR_GIT_CLONE_OPTIONS") of Option = case os:getenv("REBAR_GIT_CLONE_OPTIONS") of
false -> "" ; %% env var not set
Opt -> %% env var set to empty or others
false ->
"" ;
Opt ->
?DEBUG("Git Clone Options: ~p",[Opt]),
Opt Opt
end, end,
?DEBUG("Git clone Option = ~p",[Option]),
Option. Option.
check_type_support() -> check_type_support() ->

+ 3
- 3
src/rebar_pkg_resource.erl View File

@ -220,10 +220,10 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon
CDN = maybe_default_cdn(State), CDN = maybe_default_cdn(State),
case request(RepoConfig#{repo_url => CDN}, Name, Vsn, ETag) of case request(RepoConfig#{repo_url => CDN}, Name, Vsn, ETag) of
{ok, cached} -> {ok, cached} ->
?INFO("Version cached at ~ts is up to date, reusing it", [CachePath]),
?DEBUG("Version cached at ~ts is up to date, reusing it", [CachePath]),
serve_from_cache(TmpDir, CachePath, Pkg); serve_from_cache(TmpDir, CachePath, Pkg);
{ok, Body, NewETag} -> {ok, Body, NewETag} ->
?INFO("Downloaded package, caching at ~ts", [CachePath]),
?DEBUG("Downloaded package, caching at ~ts", [CachePath]),
maybe_store_etag_in_cache(UpdateETag, ETagPath, NewETag), maybe_store_etag_in_cache(UpdateETag, ETagPath, NewETag),
serve_from_download(TmpDir, CachePath, Pkg, Body); serve_from_download(TmpDir, CachePath, Pkg, Body);
error when ETag =/= <<>> -> error when ETag =/= <<>> ->
@ -236,7 +236,7 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon
maybe_default_cdn(State) -> maybe_default_cdn(State) ->
CDN = rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_CDN), CDN = rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_CDN),
rebar_utils:to_binary(CDN).
rebar_utils:to_binary(CDN).
-spec serve_from_cache(TmpDir, CachePath, Pkg) -> Res when -spec serve_from_cache(TmpDir, CachePath, Pkg) -> Res when
TmpDir :: file:name(), TmpDir :: file:name(),

+ 1
- 1
src/rebar_prv_install_deps.erl View File

@ -382,7 +382,7 @@ symlink_dep(State, From, To) ->
ok -> ok ->
RelativeFrom = make_relative_to_root(State, From), RelativeFrom = make_relative_to_root(State, From),
RelativeTo = make_relative_to_root(State, To), RelativeTo = make_relative_to_root(State, To),
?INFO("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]),
?DEBUG("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]),
ok; ok;
exists -> exists ->
ok ok

Loading…
Cancel
Save