From a2331633a7e16a9eb0e86c819cfdf45be3f2936f Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Tue, 29 Sep 2020 14:22:46 +0000 Subject: [PATCH] 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 --- src/rebar_app_discover.erl | 6 ++++++ src/rebar_fetch.erl | 2 +- src/rebar_git_resource.erl | 8 ++++---- src/rebar_pkg_resource.erl | 6 +++--- src/rebar_prv_install_deps.erl | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index de6566bb..1e08b77d 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -31,6 +31,12 @@ do(State, LibDirs) -> %% 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 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 State1 = lists:foldl(fun(Profile, StateAcc) -> diff --git a/src/rebar_fetch.erl b/src/rebar_fetch.erl index b2acc6d8..3696b339 100644 --- a/src/rebar_fetch.erl +++ b/src/rebar_fetch.erl @@ -59,7 +59,7 @@ download_source_(AppInfo, State) -> code:del_path(filename:absname(filename:join(AppDir1, "ebin"))), FetchDir = rebar_app_info:fetch_dir(AppInfo), 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)); Error -> Error diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 6f0123ca..7a127444 100644 --- a/src/rebar_git_resource.erl +++ b/src/rebar_git_resource.erl @@ -369,12 +369,12 @@ parse_tags(Dir) -> git_clone_options() -> 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 end, - - ?DEBUG("Git clone Option = ~p",[Option]), Option. check_type_support() -> diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index c81df706..f50ac622 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -220,10 +220,10 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon CDN = maybe_default_cdn(State), case request(RepoConfig#{repo_url => CDN}, Name, Vsn, ETag) of {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); {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), serve_from_download(TmpDir, CachePath, Pkg, Body); error when ETag =/= <<>> -> @@ -236,7 +236,7 @@ cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn, _OldHash, _Hash, RepoCon maybe_default_cdn(State) -> 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 TmpDir :: file:name(), diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 52c57156..34334d51 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -382,7 +382,7 @@ symlink_dep(State, From, To) -> ok -> RelativeFrom = make_relative_to_root(State, From), RelativeTo = make_relative_to_root(State, To), - ?INFO("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]), + ?DEBUG("Linking ~ts to ~ts", [RelativeFrom, RelativeTo]), ok; exists -> ok