Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix #56 (always-on recursion) #192

Closed
wants to merge 4 commits into from

6 participants

@tuncer

Always-on recursive application of all rebar commands causes too many issues. Recursive application is required for:
1. dealing with dependencies: get-deps, update-deps, and compile of deps right after get-deps or update-deps
2. projects with a riak-like apps/ project structure and dev process

The vast majority of projects are not structured like riak. Therefore, moving forward it's best to (by default) restrict recursive behavior to dealing with deps. This branch does that and also adds command line and rebar.config options for controlling or configuring recursion. Also, we introduce two meta commands: prepare-deps (equivalent to rebar -r get-deps compile) and refresh-deps (equivalent to rebar -r update-deps compile). riak-like projects can extend the list of recursive commands (to include 'eunit' and 'compile') by adding {recursive_cmds, [eunit, compile]} to rebar.config.

Fixes #56.

@tuncer tuncer referenced this pull request
Closed

Fix recursion #56

@si14

Wow, the long-awaited change :) Thank you!

@archaelus

At Heroku we've been using this patch on our version of rebar and found it to be great for day to day work. Working with templates, eunit and a variety of other things is far easier than it has been in the past.

:100: I would love to see this patch land in mainline.

@tuncer

@dizzyd's dss-fix-skip-deps branch completely removes skip_deps=. Should I make the same change here? What are the arguments for having both skip_apps= and and skip_deps=?

@jaredmorrow
Owner

For now I would vote to leave skip_deps, with maybe a deprecation message so it didn't instantly break people's scripts.

@tuncer

Deprecated skip_deps= in favor of skip_apps=.

@tuncer

Added a fix for #226.

@tuncer

ping

@archaelus

Updated version is still good for me - would be great to merge into mainline.

@Vagabond
Owner

What meaning is there in changing skip_deps to skip_apps? It doesn't really convey any additional or clearer meaning, and it is yet another deprecation to deal with.

@jaredmorrow
Owner

Yes, please remove the skip_apps change and put that in a separate PR. Mixing multiple topics and ideas into a single PR is really difficult to deal with.

@Vagabond
Owner

Compile not being recusive is going to break too much stuff. I just merged the speedup patch, so redundant compiles will be about twice as fast as they were. If we leave compile recursive and back-out the skip_apps change (which I guess you can make different PR for, if you really want) this can merge.

@tuncer

The deprecation message was added as a result of @jaredmorrow's suggestion (see #192 (comment)). I can extract it, if that's preferred.

@tuncer

Compile not being recusive is going to break too much stuff.

For projects that need compile to be always recursive, there's {recursive_cmds, []}. Also, for rebar get-deps compile and rebar update-deps compile there's rebar prepare-deps and rebar refresh-deps. Usually you only need to compile deps once.

We could also get {recursive_cmds,[]} from ~/.rebar/config.

If we really make compile auto-recursive, then there will be a need to override that via rebar.config or the command line for everyone else.

@Vagabond
Owner

So let people use rebar compile skip_deps=true like they did before. If we change compile we break all of the riak repos, all the documentation on rebar, etc. Jared and I are happy with making everything else not be recusrive by default, but compile is too big of a change to swallow.

If we can get the rest of this in, we can revisit the behaviour of compile later, if necessary.

@jaredmorrow
Owner

My point was not to rename skip_deps to something else. My point was to not remove skip_deps in the first place, and the only way I could reason with that is a deprecation message to skip_deps. Your comment was confusing, making it sound like skip_deps was now renamed to skip_apps. Part of this confusion is on me not even knowing that skip_apps already existed since it nor skip_deps are documented anywhere on the command line.

@jaredmorrow
Owner

I'm also of the opinion compile should be left as recursive for now since we have the speed up patch merged now, compile will already be way faster. Most books, blogs, etc. that mention rebar, mention ./rebar get-deps compile doing the right thing, breaking that is a lot bigger change IMHO than what people are making it out to be. I'm okay with the rest of this though.

@tuncer

So let people use rebar compile skip_deps=true like they did before.

skip_deps=true is not the same as disabling recursion.

My point was not to rename skip_deps to something else. My point was to not remove skip_deps in the first place, and the only way I could reason with that is a deprecation message to skip_deps. Your comment was confusing, making it sound like skip_deps was now renamed to skip_apps. Part of this confusion is on me not even knowing that skip_apps already existed since it nor skip_deps are documented anywhere on the command line.

See #244. @dizzyd's proposed fix for the recursion problem completely removes skip_deps=, and here we print a deprecation message as suggested by @jaredmorrow. Anything in need of fixing there?

I'm also of the opinion compile should be left as recursive for now since we have the speed up patch merged now, compile will already be way faster. Most books, blogs, etc. that mention rebar, mention ./rebar get-deps compile doing the right thing, breaking that is a lot bigger change IMHO than what people are making it out to be. I'm okay with the rest of this though.

Speed is not the primary motivation to exclude 'compile' from recursive_cmds, but your concerns are valid. I'll try to come up with a good solution to switch compile's recursiveness at runtime. Once that's finished, we can make 'compile' recursive by default and merge the patch.

With that being said, why not make 'compile' non-recursive and release 3.x? I mean, don't we have to bump the major version anyway due to the other changes? Also, if someone runs rebar get-deps compile, we could print a message suggesting to execute rebar prepare-deps instead.

tuncer added some commits
@tuncer tuncer Fix #56 (always-on recursion)
Always-on recursive application of all rebar commands causes too many
issues. Recursive application is required for:
1. dealing with dependencies: get-deps, update-deps, and compile of deps
   right after get-deps or update-deps
2. projects with a riak-like apps/ project structure and dev process

The vast majority of projects are not structured like riak. Therefore,
moving forward it's best to (by default) restrict recursive behavior to
dealing with deps. This commit does that and also adds command line and
rebar.config options for controlling or configuring recursion. Also, we
introduce two meta commands: prepare-deps (equivalent to rebar -r
get-deps compile) and refresh-deps (equivalent to rebar -r update-deps
compile). riak-like projects can extend the list of recursive commands
(to include 'eunit' and 'compile') by adding
{recursive_cmds, [eunit, compile]} to rebar.config.
b3806c5
@tuncer tuncer Deprecate skip_deps= in favor of skip_apps= b40ae6c
@tuncer tuncer Fix #226
Running 'rebar list-templates' can take quite a long time, when it has
to search the file system. To fix that, make list-templates not recurse
by default. To enable recursion, run 'rebar -r list-templates'.
c47a9bc
@tuncer

Added an RFC commit that detects rebar get-deps compile, suggests rebar prepare-deps, and enables recursion as a graceful deprecation measure. If you're okay with that, I'll squash it into the original commit.

@jaredmorrow
Owner

I don't like you mentioning 'compile' being only temporarily recursive. I think it should always be recursive. I thought I made that clear in previous comments.

@ferd
Owner

There's little reason for it to be compiled once I've already built my deps once, sadly. I agree that having it recursive only when it follows some kind of inherently recursive call would make sense?

Otherwise it's kind of extremely frustrating when I change a -1 to a +1 in a project of mine and the entire deps tree gets scanned/recompiled for no reason, but yeah.

@jaredmorrow
Owner

Merged in 47c089a without the non-recursive compile bits.

@tuncer tuncer deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2014
  1. @tuncer

    Fix #56 (always-on recursion)

    tuncer authored
    Always-on recursive application of all rebar commands causes too many
    issues. Recursive application is required for:
    1. dealing with dependencies: get-deps, update-deps, and compile of deps
       right after get-deps or update-deps
    2. projects with a riak-like apps/ project structure and dev process
    
    The vast majority of projects are not structured like riak. Therefore,
    moving forward it's best to (by default) restrict recursive behavior to
    dealing with deps. This commit does that and also adds command line and
    rebar.config options for controlling or configuring recursion. Also, we
    introduce two meta commands: prepare-deps (equivalent to rebar -r
    get-deps compile) and refresh-deps (equivalent to rebar -r update-deps
    compile). riak-like projects can extend the list of recursive commands
    (to include 'eunit' and 'compile') by adding
    {recursive_cmds, [eunit, compile]} to rebar.config.
  2. @tuncer
  3. @tuncer

    Fix #226

    tuncer authored
    Running 'rebar list-templates' can take quite a long time, when it has
    to search the file system. To fix that, make list-templates not recurse
    by default. To enable recursion, run 'rebar -r list-templates'.
  4. @tuncer
This page is out of date. Refresh to see the latest.
View
13 ebin/rebar.app
@@ -38,6 +38,7 @@
rebar_upgrade,
rebar_utils,
rebar_xref,
+ rebar_metacmds,
rebar_getopt,
rebar_mustache ]},
{registered, []},
@@ -80,7 +81,8 @@
rebar_escripter,
rebar_edoc,
rebar_shell,
- rebar_xref
+ rebar_xref,
+ rebar_metacmds
]},
{rel_dir, [
@@ -88,6 +90,13 @@
rebar_reltool,
rebar_upgrade
]}
- ]}
+ ]},
+ {recursive_cmds, [
+ 'get-deps',
+ 'check-deps',
+ 'delete-deps',
+ 'list-deps',
+ 'update-deps'
+ ]}
]}
]}.
View
2  inttest/depplugins/depplugins_rt.erl
@@ -39,7 +39,7 @@ files() ->
].
run(_Dir) ->
- ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
+ ?assertMatch({ok, _}, retest_sh:run("./rebar -r compile", [])),
?assertEqual(true, filelib:is_regular("base_dir_cwd_pre.compile")),
View
3  inttest/tdeps1/tdeps1_rt.erl
@@ -41,7 +41,8 @@ run(_Dir) ->
apply_cmds(GitCmds, [{dir, "repo/b"}]),
apply_cmds(GitCmds, [{dir, "repo/c"}]),
- {ok, _} = retest_sh:run("./rebar get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar get-deps", []),
+ {ok, _} = retest_sh:run("./rebar -r compile", []),
true = filelib:is_regular("ebin/a.beam"),
ok.
View
3  inttest/tdeps2/tdeps2_rt.erl
@@ -49,7 +49,8 @@ run(_Dir) ->
ok = apply_cmds(GitCmds, [{dir, "repo/b"}]),
ok = apply_cmds(GitCmds, [{dir, "repo/c"}]),
- {ok, _} = retest_sh:run("./rebar -v get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar -v get-deps", []),
+ {ok, _} = retest_sh:run("./rebar -v -r compile", []),
ok.
%%
View
3  inttest/tdeps_update/tdeps_update_rt.erl
@@ -122,7 +122,8 @@ run(_Dir) ->
ok = apply_cmds(GitCmds++ECmds, [{dir, "repo/e"}]),
ok = apply_cmds(GitCmds++FCmds, [{dir, "repo/f"}]),
- {ok, _} = retest_sh:run("./rebar -v get-deps compile", []),
+ {ok, _} = retest_sh:run("./rebar -v get-deps", []),
+ {ok, _} = retest_sh:run("./rebar -v -r compile", []),
os:cmd("cp a2.rebar.config apps/a1/rebar.config"),
{ok, _} = retest_sh:run("./rebar -v update-deps", []),
{ok, _} = retest_sh:run("./rebar -v compile", []),
View
5 priv/shell-completion/bash/rebar
@@ -6,7 +6,7 @@ _rebar()
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
- sopts="-h -c -v -V -f -D -j -C -p -k"
+ sopts="-h -c -v -V -f -D -j -C -p -k -r"
lopts="--help \
--commands \
--verbose \
@@ -15,6 +15,7 @@ _rebar()
--config \
--profile \
--keep-going \
+ --recursive \
--version"
cmdsnvars="check-deps \
clean \
@@ -35,7 +36,9 @@ _rebar()
help \
list-deps \
list-templates \
+ prepare-deps \
qc \
+ refresh-deps \
update-deps \
version \
xref \
View
3  priv/shell-completion/zsh/_rebar
@@ -17,6 +17,7 @@ _rebar_global_opts=(
'(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files'
'(--profile -p)'{--profile,-p}'[Profile this run of rebar]'
'(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]'
+ '(--recursive -r)'{--recursive,-r}'[Apply commands to subdirs and dependencies]'
)
_rebar () {
@@ -36,6 +37,8 @@ _rebar () {
'list-template[List avaiavle templates]' \
'doc[Generate Erlang program documentation]' \
'check-deps[Display to be fetched dependencies]' \
+ 'prepare-deps[Fetch and build dependencies]' \
+ 'refresh-deps[Update and build dependencies]' \
'get-deps[Fetch dependencies]' \
'update-deps[Update fetched dependencies]' \
'delete-deps[Delete fetched dependencies]' \
View
3  rebar.config.sample
@@ -5,6 +5,9 @@
%% == Core ==
+%% Extend list of always recursive commands
+{recursive_cmds, []}.
+
%% Check required ERTS or OTP release version
{require_erts_vsn, ".*"}.
{require_otp_vsn, ".*"}.
View
54 src/rebar.erl
@@ -172,8 +172,33 @@ run_aux(BaseConfig, Commands) ->
BaseConfig1 = init_config1(BaseConfig),
+ %% NOTE: Recursion is only enabled by default for *-deps commands,
+ %% and to gracefully deprecate the old behaviour of 'get-deps compile'
+ %% we detect it and enable recursion.
+ %% TODO: Disable in a future release.
+ BaseConfig2 = maybe_suggest_prepare_deps(BaseConfig1, CommandAtoms),
+
%% Process each command, resetting any state between each one
- rebar_core:process_commands(CommandAtoms, BaseConfig1).
+ rebar_core:process_commands(CommandAtoms, BaseConfig2).
+
+maybe_suggest_prepare_deps(Config, Cmds) ->
+ maybe_suggest_prepare_deps(rebar_config:is_recursive(Config), Config, Cmds).
+
+maybe_suggest_prepare_deps(true, Config, _Cmds) ->
+ Config;
+maybe_suggest_prepare_deps(false, Config, ['get-deps', compile]) ->
+ io:put_chars(
+ <<"
+Instead of 'rebar get-deps compile' you should run 'rebar prepare-deps'.
+For the time being recursion is automatically enabled when
+'get-deps compile' is executed. This is only temporary to ease the
+migration and will be disabled in a future release. Also, if you want
+'compile' to be default-recursive, add {recursive_cmds, [compile]}
+to rebar.config.
+\n">>),
+ rebar_config:set_xconf(Config, recursive, true);
+maybe_suggest_prepare_deps(false, Config, _Cmds) ->
+ Config.
%%
%% print help/usage string
@@ -206,8 +231,10 @@ help() ->
" ~p~n"
" ~p~n"
" ~p~n"
+ " ~p~n"
" ~p~n",
[
+ {recursive_cmds, []},
{lib_dirs, []},
{sub_dirs, ["dir1", "dir2"]},
{plugins, [plugin1, plugin2]},
@@ -254,19 +281,23 @@ save_options(Config, {Options, NonOptArgs}) ->
Config3 = rebar_config:set_xconf(Config2, keep_going,
proplists:get_bool(keep_going, Options)),
+ %% Setup flag to enable recursive application of commands
+ Config4 = rebar_config:set_xconf(Config3, recursive,
+ proplists:get_bool(recursive, Options)),
+
%% Set global variables based on getopt options
- Config4 = set_global_flag(Config3, Options, force),
- Config5 = case proplists:get_value(jobs, Options, ?DEFAULT_JOBS) of
+ Config5 = set_global_flag(Config4, Options, force),
+ Config6 = case proplists:get_value(jobs, Options, ?DEFAULT_JOBS) of
?DEFAULT_JOBS ->
- Config4;
+ Config5;
Jobs ->
- rebar_config:set_global(Config4, jobs, Jobs)
+ rebar_config:set_global(Config5, jobs, Jobs)
end,
%% Filter all the flags (i.e. strings of form key=value) from the
%% command line arguments. What's left will be the commands to run.
- {Config6, RawCmds} = filter_flags(Config5, NonOptArgs, []),
- {Config6, unabbreviate_command_names(RawCmds)}.
+ {Config7, RawCmds} = filter_flags(Config6, NonOptArgs, []),
+ {Config7, unabbreviate_command_names(RawCmds)}.
%%
%% set log level based on getopt option
@@ -358,6 +389,9 @@ list-templates List available templates
doc Generate Erlang program documentation
+prepare-deps Run 'rebar -r get-deps compile'
+refresh-deps Run 'rebar -r update-deps compile'
+
check-deps Display to be fetched dependencies
get-deps Fetch dependencies
update-deps Update fetched dependencies
@@ -420,7 +454,9 @@ option_spec_list() ->
{config, $C, "config", string, "Rebar config file to use"},
{profile, $p, "profile", undefined, "Profile this run of rebar"},
{keep_going, $k, "keep-going", undefined,
- "Keep running after a command fails"}
+ "Keep running after a command fails"},
+ {recursive, $r, "recursive", boolean,
+ "Apply commands to subdirs and dependencies"}
].
%%
@@ -469,7 +505,9 @@ command_names() ->
"help",
"list-deps",
"list-templates",
+ "prepare-deps",
"qc",
+ "refresh-deps",
"update-deps",
"overlay",
"shell",
View
4 src/rebar_config.erl
@@ -31,6 +31,7 @@
get_all/2,
set/3,
set_global/3, get_global/3,
+ is_recursive/1,
save_env/3, get_env/2, reset_envs/1,
set_skip_dir/2, is_skip_dir/2, reset_skip_dirs/1,
clean_config/2,
@@ -109,6 +110,9 @@ get_global(Config, Key, Default) ->
Value
end.
+is_recursive(Config) ->
+ get_xconf(Config, recursive, false).
+
consult_file(File) ->
case filename:extension(File) of
".script" ->
View
30 src/rebar_core.erl
@@ -122,26 +122,44 @@ process_dir(Dir, ParentConfig, Command, DirSet) ->
false ->
?WARN("Skipping non-existent sub-dir: ~p\n", [Dir]),
{ParentConfig, DirSet};
+ true ->
+ maybe_process_dir(Dir, ParentConfig, Command, DirSet)
+ end.
+maybe_process_dir(Dir, ParentConfig, Command, DirSet) ->
+ case should_cd_into_dir(Dir, ParentConfig, Command) of
true ->
ok = file:set_cwd(Dir),
Config = maybe_load_local_config(Dir, ParentConfig),
%% Save the current code path and then update it with
- %% lib_dirs. Children inherit parents code path, but we
- %% also want to ensure that we restore everything to pristine
+ %% lib_dirs. Children inherit parents code path, but we also
+ %% want to ensure that we restore everything to pristine
%% condition after processing this child
CurrentCodePath = update_code_path(Config),
- %% Get the list of processing modules and check each one against
- %% CWD to see if it's a fit -- if it is, use that set of modules
- %% to process this dir.
+ %% Get the list of processing modules and check each one
+ %% against CWD to see if it's a fit -- if it is, use that
+ %% set of modules to process this dir.
{ok, AvailModuleSets} = application:get_env(rebar, modules),
ModuleSet = choose_module_set(AvailModuleSets, Dir),
skip_or_process_dir(ModuleSet, Config, CurrentCodePath,
- Dir, Command, DirSet)
+ Dir, Command, DirSet);
+ false ->
+ {ParentConfig, DirSet}
end.
+should_cd_into_dir(Dir, Config, Command) ->
+ rebar_utils:processing_base_dir(Config, Dir) orelse
+ rebar_config:is_recursive(Config) orelse
+ is_recursive_command(Config, Command).
+
+is_recursive_command(Config, Command) ->
+ {ok, AppCmds} = application:get_env(rebar, recursive_cmds),
+ ConfCmds = rebar_config:get_local(Config, recursive_cmds, []),
+ RecursiveCmds = AppCmds ++ ConfCmds,
+ lists:member(Command, RecursiveCmds).
+
skip_or_process_dir({[], undefined}=ModuleSet, Config, CurrentCodePath,
Dir, Command, DirSet) ->
process_dir1(Dir, Command, DirSet, Config, CurrentCodePath, ModuleSet);
View
50 src/rebar_deps.erl
@@ -95,31 +95,41 @@ preprocess(Config, _) ->
%%
%% Also, if skip_deps=comma,separated,app,list, then only the given
%% dependencies are skipped.
- NewConfig =
- case rebar_config:get_global(Config3, skip_deps, false) of
- "true" ->
- lists:foldl(
- fun(#dep{dir = Dir}, C) ->
- rebar_config:set_skip_dir(C, Dir)
- end, Config3, AvailableDeps);
- Apps when is_list(Apps) ->
- SkipApps = [list_to_atom(App) ||
- App <- string:tokens(Apps, ",")],
- lists:foldl(
- fun(#dep{dir = Dir, app = App}, C) ->
- case lists:member(App, SkipApps) of
- true -> rebar_config:set_skip_dir(C, Dir);
- false -> C
- end
- end, Config3, AvailableDeps);
- _ ->
- Config3
- end,
+ NewConfig = maybe_skip_deps(Config3, AvailableDeps),
%% Return all the available dep directories for process
{ok, NewConfig, dep_dirs(NonRawAvailableDeps)}
end.
+maybe_skip_deps(Config, AvailableDeps) ->
+ case rebar_config:get_global(Config, skip_deps, false) of
+ false ->
+ Config;
+ Skip ->
+ ?WARN(
+ "skip_deps= has been deprecated in favor of skip_apps= and "
+ "will be~nremoved in a future release.~n", []),
+ maybe_skip_deps(Config, AvailableDeps, Skip)
+ end.
+
+maybe_skip_deps(Config, AvailableDeps, Skip) ->
+ case Skip of
+ "true" ->
+ lists:foldl(
+ fun(#dep{dir = Dir}, C) ->
+ rebar_config:set_skip_dir(C, Dir)
+ end, Config, AvailableDeps);
+ Apps when is_list(Apps) ->
+ SkipApps = [list_to_atom(App) || App <- string:tokens(Apps, ",")],
+ lists:foldl(
+ fun(#dep{dir = Dir, app = App}, C) ->
+ case lists:member(App, SkipApps) of
+ true -> rebar_config:set_skip_dir(C, Dir);
+ false -> C
+ end
+ end, Config, AvailableDeps)
+ end.
+
postprocess(Config, _) ->
case rebar_config:get_xconf(Config, ?MODULE, undefined) of
undefined ->
View
56 src/rebar_metacmds.erl
@@ -0,0 +1,56 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+%% -------------------------------------------------------------------
+%%
+%% rebar: Erlang Build Tools
+%%
+%% Copyright (c) 2013-2014 Tuncer Ayaz
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in
+%% all copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+%% -------------------------------------------------------------------
+-module(rebar_metacmds).
+
+-export(['prepare-deps'/2,
+ 'refresh-deps'/2]).
+
+%% for internal use only
+-export([info/2]).
+
+-include("rebar.hrl").
+
+%% ===================================================================
+%% Public API
+%% ===================================================================
+'prepare-deps'(Config, _AppFile) ->
+ rebar:run(enable_recursion(Config), ["get-deps", "compile"]).
+
+'refresh-deps'(Config, _AppFile) ->
+ rebar:run(enable_recursion(Config), ["update-deps", "compile"]).
+
+%% ===================================================================
+%% Internal functions
+%% ===================================================================
+
+info(help, 'prepare-deps') ->
+ ?CONSOLE("Meta command to run 'rebar -r get-deps compile'.~n", []);
+info(help, 'refresh-deps') ->
+ ?CONSOLE("Meta command to run 'rebar -r update-deps compile'.~n", []).
+
+enable_recursion(Config) ->
+ rebar_config:set_xconf(Config, recursive, true).
View
3  src/rebar_templater.erl
@@ -245,7 +245,8 @@ find_disk_templates(Config) ->
HomeFiles = rebar_utils:find_files(filename:join([os:getenv("HOME"),
".rebar", "templates"]),
?TEMPLATE_RE),
- LocalFiles = rebar_utils:find_files(".", ?TEMPLATE_RE),
+ Recursive = rebar_config:is_recursive(Config),
+ LocalFiles = rebar_utils:find_files(".", ?TEMPLATE_RE, Recursive),
[{file, F} || F <- OtherTemplates ++ HomeFiles ++ LocalFiles].
find_other_templates(Config) ->
Something went wrong with that request. Please try again.