summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-11-09 18:29:38 -0600
committerTristan Sloughter <t@crashfast.com>2014-11-09 18:29:38 -0600
commit79b1f2324006307e581ce19b24faf3b2edc5f8a9 (patch)
treeacc4fcd12899f7eecffb4493df7b12830de20cbf
parent8d02c0767ed8417d71e2789e65039d30c5375bd0 (diff)
move back to using format_error/1
-rw-r--r--rebar.config6
-rw-r--r--src/rebar3.erl3
-rw-r--r--src/rebar_prv_app_discovery.erl8
-rw-r--r--src/rebar_prv_clean.erl8
-rw-r--r--src/rebar_prv_common_test.erl8
-rw-r--r--src/rebar_prv_compile.erl11
-rw-r--r--src/rebar_prv_deps.erl8
-rw-r--r--src/rebar_prv_dialyzer.erl12
-rw-r--r--src/rebar_prv_do.erl8
-rw-r--r--src/rebar_prv_erlydtl_compiler.erl8
-rw-r--r--src/rebar_prv_eunit.erl8
-rw-r--r--src/rebar_prv_help.erl8
-rw-r--r--src/rebar_prv_install_deps.erl8
-rw-r--r--src/rebar_prv_lock.erl8
-rw-r--r--src/rebar_prv_new.erl8
-rw-r--r--src/rebar_prv_packages.erl8
-rw-r--r--src/rebar_prv_release.erl16
-rw-r--r--src/rebar_prv_shell.erl8
-rw-r--r--src/rebar_prv_tar.erl8
-rw-r--r--src/rebar_prv_test_deps.erl8
-rw-r--r--src/rebar_prv_update.erl8
-rw-r--r--src/rebar_prv_upgrade.erl8
-rw-r--r--src/rebar_prv_version.erl8
23 files changed, 98 insertions, 94 deletions
diff --git a/rebar.config b/rebar.config
index c505ef9..7e8f832 100644
--- a/rebar.config
+++ b/rebar.config
@@ -31,10 +31,10 @@
{branch, "master"}}},
{providers, "",
{git, "https://github.com/tsloughter/providers.git",
- {branch, "master"}}},
+ {branch, "format_error1"}}},
{relx, "",
- {git, "https://github.com/erlware/relx.git",
- {branch, "master"}}},
+ {git, "https://github.com/tsloughter/relx.git",
+ {branch, "format_error1"}}},
{getopt, "", {git, "https://github.com/jcomellas/getopt.git", {branch, "master"}}}]}.
{erlydtl_opts, [{doc_root, "priv/templates"},
diff --git a/src/rebar3.erl b/src/rebar3.erl
index e8bb8d5..ab874e5 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -56,8 +56,7 @@ main(Args) ->
?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace", []),
?DEBUG("Uncaught error: ~p ~p", [Module, Reason]);
_ ->
- {Error, _} = Module:format_error(Reason, []),
- ?ERROR(Error, [])
+ ?ERROR(Module:format_error(Reason), [])
end,
rebar_utils:delayed_halt(1);
{error, Error} when is_list(Error) ->
diff --git a/src/rebar_prv_app_discovery.erl b/src/rebar_prv_app_discovery.erl
index e2dcf23..ccc470b 100644
--- a/src/rebar_prv_app_discovery.erl
+++ b/src/rebar_prv_app_discovery.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -36,6 +36,6 @@ do(State) ->
State1 = rebar_app_discover:do(State, LibDirs),
{ok, State1}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl
index a64e63a..2a5abf7 100644
--- a/src/rebar_prv_clean.erl
+++ b/src/rebar_prv_clean.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -55,9 +55,9 @@ do(State) ->
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index ce63192..c2d023b 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -38,9 +38,9 @@ do(State) ->
ct:run_test(Opts),
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
expand_test_deps(Dir) ->
Apps = filelib:wildcard(filename:join([Dir, "*", "ebin"])),
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl
index 5787bd3..b53742d 100644
--- a/src/rebar_prv_compile.erl
+++ b/src/rebar_prv_compile.erl
@@ -4,8 +4,9 @@
-export([init/1,
do/1,
- format_error/2,
- build/2]).
+ format_error/1]).
+
+-export([build/2]).
-include("rebar.hrl").
@@ -59,9 +60,9 @@ do(State) ->
{ok, State1}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
build_apps(State, Apps) ->
lists:foreach(fun(AppInfo) ->
diff --git a/src/rebar_prv_deps.erl b/src/rebar_prv_deps.erl
index 80122ac..36b23fa 100644
--- a/src/rebar_prv_deps.erl
+++ b/src/rebar_prv_deps.erl
@@ -4,7 +4,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -27,9 +27,9 @@ init(State) ->
do(State) ->
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
info(Description) ->
io_lib:format("~s.~n"
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index 2cbdb77..20a58f3 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -64,11 +64,11 @@ do(State) ->
{error, {?MODULE, {error_processing_apps, Error, Apps}}}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error({error_processing_apps, Error, _Apps}, State) ->
- {io_lib:format("Error in dialyzing apps: ~s", [Error]), State};
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error({error_processing_apps, Error, _Apps}) ->
+ io_lib:format("Error in dialyzing apps: ~s", [Error]);
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% Internal functions
diff --git a/src/rebar_prv_do.erl b/src/rebar_prv_do.erl
index e66fdbd..10888eb 100644
--- a/src/rebar_prv_do.erl
+++ b/src/rebar_prv_do.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -41,9 +41,9 @@ do(State) ->
rebar_core:process_command(StateAcc2, Task)
end, {ok, State}, Tasks).
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
args_to_tasks(Args) ->
[string:strip(T) || T <- string:tokens(string:join(Args, " "), ",")].
diff --git a/src/rebar_prv_erlydtl_compiler.erl b/src/rebar_prv_erlydtl_compiler.erl
index 18c6e20..8ae6d03 100644
--- a/src/rebar_prv_erlydtl_compiler.erl
+++ b/src/rebar_prv_erlydtl_compiler.erl
@@ -98,7 +98,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
%% for internal use only
-export([info/2]).
@@ -146,9 +146,9 @@ do(Config) ->
true = code:set_path(OrigPath),
{Result, Config}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index c982467..8f05f02 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -50,9 +50,9 @@ do(State) ->
end,
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
run_eunit(Config, CodePath, SrcErls) ->
%% Build a list of all the .beams in ?EUNIT_DIR -- use this for
diff --git a/src/rebar_prv_help.erl b/src/rebar_prv_help.erl
index 8300378..7d39959 100644
--- a/src/rebar_prv_help.erl
+++ b/src/rebar_prv_help.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -50,9 +50,9 @@ do(State) ->
end
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%%
%% print help/usage string
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index ce8a7e0..f3c050e 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -30,7 +30,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -90,9 +90,9 @@ do(State) ->
{error, Reason}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
-spec get_deps_dir(rebar_state:t()) -> file:filename_all().
get_deps_dir(State) ->
diff --git a/src/rebar_prv_lock.erl b/src/rebar_prv_lock.erl
index 32c5f1a..4ada1ef 100644
--- a/src/rebar_prv_lock.erl
+++ b/src/rebar_prv_lock.erl
@@ -4,7 +4,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -55,9 +55,9 @@ do(State) ->
{ok, State}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
info(_) ->
"".
diff --git a/src/rebar_prv_new.erl b/src/rebar_prv_new.erl
index 2555b4d..698b14e 100644
--- a/src/rebar_prv_new.erl
+++ b/src/rebar_prv_new.erl
@@ -4,7 +4,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -42,9 +42,9 @@ do(State) ->
{ok, State}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_prv_packages.erl b/src/rebar_prv_packages.erl
index be51833..37511bd 100644
--- a/src/rebar_prv_packages.erl
+++ b/src/rebar_prv_packages.erl
@@ -4,7 +4,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -29,9 +29,9 @@ do(State) ->
print_packages(Packages),
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
print_packages(Packages) ->
Keys = lists:keysort(1, dict:fetch_keys(Packages)),
diff --git a/src/rebar_prv_release.erl b/src/rebar_prv_release.erl
index 3ac826e..d2ff77a 100644
--- a/src/rebar_prv_release.erl
+++ b/src/rebar_prv_release.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -34,13 +34,17 @@ init(State) ->
do(State) ->
Options = rebar_state:command_args(State),
DepsDir = rebar_prv_install_deps:get_deps_dir(State),
+ OutputDir = filename:join(rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR), "releases"),
AllOptions = string:join(["release" | Options], " "),
try
case rebar_state:get(State, relx, []) of
[] ->
- relx:main([{lib_dirs, [DepsDir]}], AllOptions);
+ relx:main([{lib_dirs, [DepsDir]}
+ ,{output_dir, OutputDir}], AllOptions);
Config ->
- relx:main([{lib_dirs, [DepsDir]}, {config, Config}], AllOptions)
+ relx:main([{lib_dirs, [DepsDir]}
+ ,{config, Config}
+ ,{output_dir, OutputDir}], AllOptions)
end,
{ok, State}
catch
@@ -48,6 +52,6 @@ do(State) ->
{error, {rlx_prv_release, T}}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl
index 932cad7..9709807 100644
--- a/src/rebar_prv_shell.erl
+++ b/src/rebar_prv_shell.erl
@@ -32,7 +32,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -60,9 +60,9 @@ do(Config) ->
shell(),
{ok, Config}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% NOTE:
%% this is an attempt to replicate `erl -pa ./ebin -pa deps/*/ebin`. it is
diff --git a/src/rebar_prv_tar.erl b/src/rebar_prv_tar.erl
index 184a1b4..c87782e 100644
--- a/src/rebar_prv_tar.erl
+++ b/src/rebar_prv_tar.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -43,6 +43,6 @@ do(State) ->
end,
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
diff --git a/src/rebar_prv_test_deps.erl b/src/rebar_prv_test_deps.erl
index c77f1c0..7975f27 100644
--- a/src/rebar_prv_test_deps.erl
+++ b/src/rebar_prv_test_deps.erl
@@ -4,7 +4,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -52,9 +52,9 @@ do(State) ->
{error, Error}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
%% ===================================================================
%% Internal functions
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 4952ed2..eb7727b 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -47,9 +47,9 @@ do(State) ->
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(package_index_write, State) ->
- {"Failed to write package index.", State}.
+-spec format_error(any()) -> iolist().
+format_error(package_index_write) ->
+ "Failed to write package index.".
url(State) ->
SystemArch = erlang:system_info(system_architecture),
diff --git a/src/rebar_prv_upgrade.erl b/src/rebar_prv_upgrade.erl
index 8c1c84e..8b18f5e 100644
--- a/src/rebar_prv_upgrade.erl
+++ b/src/rebar_prv_upgrade.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -49,6 +49,6 @@ do(State) ->
{error, io_lib:format("No such dependency ~s~n", [Name])}
end.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).
diff --git a/src/rebar_prv_version.erl b/src/rebar_prv_version.erl
index 1e907d1..727bdc1 100644
--- a/src/rebar_prv_version.erl
+++ b/src/rebar_prv_version.erl
@@ -7,7 +7,7 @@
-export([init/1,
do/1,
- format_error/2]).
+ format_error/1]).
-include("rebar.hrl").
@@ -36,6 +36,6 @@ do(State) ->
rebar3:version(),
{ok, State}.
--spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
-format_error(Reason, State) ->
- {io_lib:format("~p", [Reason]), State}.
+-spec format_error(any()) -> iolist().
+format_error(Reason) ->
+ io_lib:format("~p", [Reason]).