mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
rebar_deps: fix overly long lines
This commit is contained in:
parent
95910c7764
commit
d49ac03627
1 changed files with 50 additions and 39 deletions
|
@ -78,27 +78,33 @@ preprocess(Config, _) ->
|
||||||
%% any other calls to preprocess() for update-deps beyond the
|
%% any other calls to preprocess() for update-deps beyond the
|
||||||
%% toplevel directory. They aren't actually harmful, but they slow
|
%% toplevel directory. They aren't actually harmful, but they slow
|
||||||
%% things down unnecessarily.
|
%% things down unnecessarily.
|
||||||
NewConfig = lists:foldl(fun(D, Acc) ->
|
NewConfig = lists:foldl(
|
||||||
|
fun(D, Acc) ->
|
||||||
rebar_config:set_skip_dir(Acc, D#dep.dir)
|
rebar_config:set_skip_dir(Acc, D#dep.dir)
|
||||||
end, Config3, collect_deps(rebar_utils:get_cwd(), Config3)),
|
end,
|
||||||
|
Config3,
|
||||||
|
collect_deps(rebar_utils:get_cwd(), Config3)),
|
||||||
%% Return the empty list, as we don't want anything processed before
|
%% Return the empty list, as we don't want anything processed before
|
||||||
%% us.
|
%% us.
|
||||||
{ok, NewConfig, []};
|
{ok, NewConfig, []};
|
||||||
_ ->
|
_ ->
|
||||||
%% If skip_deps=true, mark each dep dir as a skip_dir w/ the core so that
|
%% If skip_deps=true, mark each dep dir as a skip_dir w/ the core
|
||||||
%% the current command doesn't run on the dep dir. However, pre/postprocess
|
%% so that the current command doesn't run on the dep dir.
|
||||||
%% WILL run (and we want it to) for transitivity purposes.
|
%% However, pre/postprocess WILL run (and we want it to) for
|
||||||
|
%% transitivity purposes.
|
||||||
%%
|
%%
|
||||||
%% Also, if skip_deps=comma,separated,app,list, then only the given
|
%% Also, if skip_deps=comma,separated,app,list, then only the given
|
||||||
%% dependencies are skipped.
|
%% dependencies are skipped.
|
||||||
NewConfig = case rebar_config:get_global(Config3, skip_deps, false) of
|
NewConfig =
|
||||||
|
case rebar_config:get_global(Config3, skip_deps, false) of
|
||||||
"true" ->
|
"true" ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#dep{dir = Dir}, C) ->
|
fun(#dep{dir = Dir}, C) ->
|
||||||
rebar_config:set_skip_dir(C, Dir)
|
rebar_config:set_skip_dir(C, Dir)
|
||||||
end, Config3, AvailableDeps);
|
end, Config3, AvailableDeps);
|
||||||
Apps when is_list(Apps) ->
|
Apps when is_list(Apps) ->
|
||||||
SkipApps = [list_to_atom(App) || App <- string:tokens(Apps, ",")],
|
SkipApps = [list_to_atom(App) ||
|
||||||
|
App <- string:tokens(Apps, ",")],
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#dep{dir = Dir, app = App}, C) ->
|
fun(#dep{dir = Dir, app = App}, C) ->
|
||||||
case lists:member(App, SkipApps) of
|
case lists:member(App, SkipApps) of
|
||||||
|
@ -440,7 +446,8 @@ is_app_available(Config, App, VsnRegex, Path, _IsRaw = false) ->
|
||||||
{Config, {false, {missing_app_file, Path}}}
|
{Config, {false, {missing_app_file, Path}}}
|
||||||
end;
|
end;
|
||||||
is_app_available(Config, App, _VsnRegex, Path, _IsRaw = true) ->
|
is_app_available(Config, App, _VsnRegex, Path, _IsRaw = true) ->
|
||||||
?DEBUG("is_app_available, looking for Raw Depencency ~p with Path ~p~n", [App, Path]),
|
?DEBUG("is_app_available, looking for Raw Depencency ~p with Path ~p~n",
|
||||||
|
[App, Path]),
|
||||||
case filelib:is_dir(Path) of
|
case filelib:is_dir(Path) of
|
||||||
true ->
|
true ->
|
||||||
%% TODO: look for version string in <Path>/VERSION file? Not clear
|
%% TODO: look for version string in <Path>/VERSION file? Not clear
|
||||||
|
@ -463,8 +470,8 @@ use_source(Config, Dep, Count) ->
|
||||||
case filelib:is_dir(Dep#dep.dir) of
|
case filelib:is_dir(Dep#dep.dir) of
|
||||||
true ->
|
true ->
|
||||||
%% Already downloaded -- verify the versioning matches the regex
|
%% Already downloaded -- verify the versioning matches the regex
|
||||||
case is_app_available(Config, Dep#dep.app,
|
case is_app_available(Config, Dep#dep.app, Dep#dep.vsn_regex,
|
||||||
Dep#dep.vsn_regex, Dep#dep.dir, Dep#dep.is_raw) of
|
Dep#dep.dir, Dep#dep.is_raw) of
|
||||||
{Config1, {true, _}} ->
|
{Config1, {true, _}} ->
|
||||||
Dir = filename:join(Dep#dep.dir, "ebin"),
|
Dir = filename:join(Dep#dep.dir, "ebin"),
|
||||||
ok = filelib:ensure_dir(filename:join(Dir, "dummy")),
|
ok = filelib:ensure_dir(filename:join(Dir, "dummy")),
|
||||||
|
@ -562,7 +569,8 @@ update_source1(AppDir, {git, _Url, {branch, Branch}}) ->
|
||||||
ShOpts = [{cd, AppDir}],
|
ShOpts = [{cd, AppDir}],
|
||||||
rebar_utils:sh("git fetch origin", ShOpts),
|
rebar_utils:sh("git fetch origin", ShOpts),
|
||||||
rebar_utils:sh(?FMT("git checkout -q ~s", [Branch]), ShOpts),
|
rebar_utils:sh(?FMT("git checkout -q ~s", [Branch]), ShOpts),
|
||||||
rebar_utils:sh(?FMT("git pull --ff-only --no-rebase -q origin ~s", [Branch]), ShOpts);
|
rebar_utils:sh(
|
||||||
|
?FMT("git pull --ff-only --no-rebase -q origin ~s", [Branch]),ShOpts);
|
||||||
update_source1(AppDir, {git, _Url, {tag, Tag}}) ->
|
update_source1(AppDir, {git, _Url, {tag, Tag}}) ->
|
||||||
ShOpts = [{cd, AppDir}],
|
ShOpts = [{cd, AppDir}],
|
||||||
rebar_utils:sh("git fetch --tags origin", ShOpts),
|
rebar_utils:sh("git fetch --tags origin", ShOpts),
|
||||||
|
@ -608,10 +616,12 @@ update_deps_int(Config0, UDD) ->
|
||||||
|
|
||||||
lists:foldl(fun(Dep, {Config, Updated}) ->
|
lists:foldl(fun(Dep, {Config, Updated}) ->
|
||||||
{true, AppDir} = get_deps_dir(Config, Dep#dep.app),
|
{true, AppDir} = get_deps_dir(Config, Dep#dep.app),
|
||||||
Config2 = case has_vcs_dir(element(1, Dep#dep.source), AppDir) of
|
Config2 = case has_vcs_dir(element(1, Dep#dep.source),
|
||||||
|
AppDir) of
|
||||||
false ->
|
false ->
|
||||||
%% If the dep did not exist (maybe it was added)
|
%% If the dep did not exist (maybe it
|
||||||
%% clone it. We'll traverse ITS deps below. and
|
%% was added), clone it.
|
||||||
|
%% We'll traverse ITS deps below and
|
||||||
%% clone them if needed.
|
%% clone them if needed.
|
||||||
{C1, _D1} = use_source(Config, Dep),
|
{C1, _D1} = use_source(Config, Dep),
|
||||||
C1;
|
C1;
|
||||||
|
@ -657,7 +667,8 @@ collect_deps(Dir, C) ->
|
||||||
{Config1, Deps} = find_deps(Config, read, RawDeps),
|
{Config1, Deps} = find_deps(Config, read, RawDeps),
|
||||||
|
|
||||||
lists:flatten(Deps ++ [begin
|
lists:flatten(Deps ++ [begin
|
||||||
{true, AppDir} = get_deps_dir(Config1, Dep#dep.app),
|
{true, AppDir} = get_deps_dir(
|
||||||
|
Config1, Dep#dep.app),
|
||||||
collect_deps(AppDir, C)
|
collect_deps(AppDir, C)
|
||||||
end || Dep <- Deps]);
|
end || Dep <- Deps]);
|
||||||
_ ->
|
_ ->
|
||||||
|
|
Loading…
Reference in a new issue