Permalink
Browse files

Add experimental option --no-deps and support for skip_deps in rebar …

…plugin
  • Loading branch information...
1 parent 520de34 commit 77bdace960e8d4a350ff70a2f773d9c195bf0bf2 @yrashk yrashk committed Jul 6, 2011
Showing with 26 additions and 8 deletions.
  1. BIN rebar
  2. +12 −4 src/agner_fetch.erl
  3. +4 −2 src/agner_main.erl
  4. +10 −2 src/agner_rebar_plugin.erl
View
BIN rebar
Binary file not shown.
View
16 src/agner_fetch.erl
@@ -25,7 +25,8 @@
spec,
package_path,
quiet,
- nofetch
+ nofetch,
+ nodeps
}).
-record(state, {
@@ -235,7 +236,10 @@ fetched(fetch_requirements, #state{ opts = #opts_rec{ spec = {spec, Spec} } = Op
os:putenv("__AGNER_DEP_DIRECTORY", ""),
{next_state, fetched, State};
-fetched(fetch_deps, #state{ opts = #opts_rec{ spec = {spec, Spec} } = Opts } = State) ->
+fetched(fetch_deps, #state{ opts = #opts_rec { nodeps = true } } = State) ->
+ {next_state, fetched, State};
+
+fetched(fetch_deps, #state{ opts = #opts_rec{ spec = {spec, Spec}, nodeps = false } = Opts } = State) ->
RebarCommands = proplists:get_value(rebar_fetch_deps_commands, Spec),
rebar(RebarCommands, Opts),
fetch_deps_command(Opts),
@@ -461,7 +465,9 @@ current_agner_version() ->
{agner,_,CurrentAgnerVersion} = lists:keyfind(agner,1,application:which_applications()),
CurrentAgnerVersion.
-build_dep(ReqName, ReqVersion, #opts_rec{ spec = {spec, Spec}, directory = Directory0 } = Opts) ->
+build_dep(_ReqName, _ReqVersion, #opts_rec{ nodeps = true }) ->
+ ignore;
+build_dep(ReqName, ReqVersion, #opts_rec{ spec = {spec, Spec}, directory = Directory0, nodeps = false } = Opts) ->
Directory =
case os:getenv("__AGNER_DEP_DIRECTORY") of
false ->
@@ -477,7 +483,9 @@ build_dep(ReqName, ReqVersion, #opts_rec{ spec = {spec, Spec}, directory = Direc
agner_main:handle_command(fetch, [{package, ReqName},{version, ReqVersion},
{directory, filename:join(deps_dir(Spec, Directory),ReqName)}|
proplists:delete(spec,rec_to_opts(Opts))]).
-rebar(RebarCommands, #opts_rec{ spec = {spec, Spec} } = Opts) ->
+rebar(RebarCommands, #opts_rec{ nodeps = true } = Opts) ->
+ rebar(RebarCommands ++ ["skip_deps=true"], Opts#opts_rec{ nodeps = false });
+rebar(RebarCommands, #opts_rec{ spec = {spec, Spec}, nodeps = false } = Opts) ->
case proplists:get_value(rebar_compatible, Spec) of
true ->
ScriptName = filename:absname(escript:script_name()),
View
6 src/agner_main.erl
@@ -73,7 +73,8 @@ arg_proplist() ->
{install, $i, "install", {boolean, false}, "Install package (if install_command is available)"},
{spec, $s, "spec-file", string, "Use local specification file"},
{quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"},
- {indices, undefined, "indices", string, "Custom list of indices, as an Erlang term, followed by a dot. Example: '[{github,\"yrashk\"}]'"}
+ {indices, undefined, "indices", string, "Custom list of indices, as an Erlang term, followed by a dot. Example: '[{github,\"yrashk\"}]'"},
+ {nodeps, undefined, "no-deps", {boolean, false}, "Don't fetch dependencies"}
]}},
{"install",
{install,
@@ -116,7 +117,8 @@ arg_proplist() ->
{directory, undefined, undefined, string, "Directory to check package out to"},
{quiet, $q, "quiet", {boolean, false}, "Don't render build/install scripts output"},
{nofetch, undefined, "no-fetch", {boolean, false}, "Don't (re)-fetch the source code"},
- {indices, undefined, "indices", string, "Custom list of indices, as an Erlang term, followed by a dot. Example: '[{github,\"yrashk\"}]'"}
+ {indices, undefined, "indices", string, "Custom list of indices, as an Erlang term, followed by a dot. Example: '[{github,\"yrashk\"}]'"},
+ {nodeps, undefined, "no-deps", {boolean, false}, "Don't fetch dependencies"}
]}},
{"create",
{create,
View
12 src/agner_rebar_plugin.erl
@@ -13,7 +13,7 @@
set_indices(Config),
{Pid, Ref} = erlang:spawn_monitor(fun () ->
agner_main:handle_command(fetch,[{app, AppFile},{version, "@master"},{addpath, false},
- {install, false},{build, false}])
+ {install, false},{build, false}, nodeps_flag()])
end),
receive
{'DOWN', Ref, process, Pid, normal} ->
@@ -27,7 +27,7 @@ pre_compile(Config, AppFile) ->
agner_main:handle_command(build,[{app, AppFile},{version, "@master"},{quiet, false},
{nofetch, true},
{addpath, false},
- {install, false}])
+ {install, false},nodeps_flag()])
end),
receive
{'DOWN', Ref, process, Pid, normal} ->
@@ -45,4 +45,12 @@ ensure_agner_started() ->
_ ->
ok %% already started
end.
+
+nodeps_flag() ->
+ case rebar_config:get_global(skip_deps, false) of
+ "true" ->
+ {nodeps, true};
+ _ ->
+ {nodeps, false}
+ end.

0 comments on commit 77bdace

Please sign in to comment.