From 1ff904f39a07416a6739bd97b8f94c504e1587d0 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 8 Nov 2014 09:15:09 -0600 Subject: handle throw by relx --- include/rebar.hrl | 2 +- src/rebar3.erl | 16 ++++++++-------- src/rebar_base_compiler.erl | 34 +++++++++++++++++----------------- src/rebar_config.erl | 6 +++--- src/rebar_cover_utils.erl | 12 ++++++------ src/rebar_erlc_compiler.erl | 14 +++++++------- src/rebar_git_resource.erl | 12 ++++++------ src/rebar_log.erl | 2 +- src/rebar_otp_app.erl | 18 +++++++++--------- src/rebar_prv_compile.erl | 2 +- src/rebar_prv_erlydtl_compiler.erl | 6 +++--- src/rebar_prv_eunit.erl | 6 +++--- src/rebar_prv_install_deps.erl | 4 ++-- src/rebar_prv_release.erl | 19 ++++++++++++------- src/rebar_prv_shell.erl | 4 ++-- src/rebar_templater.erl | 10 +++++----- src/rebar_utils.erl | 6 +++--- 17 files changed, 89 insertions(+), 84 deletions(-) diff --git a/include/rebar.hrl b/include/rebar.hrl index 0980600..e84c197 100644 --- a/include/rebar.hrl +++ b/include/rebar.hrl @@ -4,7 +4,7 @@ -define(FAIL, rebar_utils:abort()). -define(ABORT(Str, Args), rebar_utils:abort(Str, Args)). --define(CONSOLE(Str, Args), io:format(Str, Args)). +-define(CONSOLE(Str, Args), io:format(Str++"~n", Args)). -define(DEBUG(Str, Args), rebar_log:log(debug, Str, Args)). -define(INFO(Str, Args), rebar_log:log(info, Str, Args)). diff --git a/src/rebar3.erl b/src/rebar3.erl index f023ce1..ecfd67e 100644 --- a/src/rebar3.erl +++ b/src/rebar3.erl @@ -54,20 +54,20 @@ main(Args) -> {error, {Module, Reason}} -> case code:which(Module) of non_existing -> - ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace~n", []), - ?DEBUG("Uncaught error: ~p ~p~n", [Module, Reason]); + ?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, []), []) end, rebar_utils:delayed_halt(1); {error, Error} when is_list(Error) -> - ?ERROR(Error++"~n", []), + ?ERROR(Error, []), rebar_utils:delayed_halt(1); Error -> %% Nothing should percolate up from rebar_core; %% Dump this error to console - ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace~n", []), - ?DEBUG("Uncaught error: ~p~n", [Error]), + ?ERROR("Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace", []), + ?DEBUG("Uncaught error: ~p", [Error]), rebar_utils:delayed_halt(1) end. @@ -87,7 +87,7 @@ run(RawArgs) -> case erlang:system_info(version) of "6.1" -> - ?WARN("Due to a filelib bug in Erlang 17.1 it is recommended you update to a newer release.~n", []); + ?WARN("Due to a filelib bug in Erlang 17.1 it is recommended you update to a newer release.", []); _ -> ok end, @@ -122,7 +122,7 @@ init_config() -> GlobalConfigFile = filename:join([os:getenv("HOME"), ".rebar", "config"]), State = case filelib:is_regular(GlobalConfigFile) of true -> - ?DEBUG("Load global config file ~p~n", + ?DEBUG("Load global config file ~p", [GlobalConfigFile]), GlobalConfig = rebar_state:new(rebar_config:consult_file(GlobalConfigFile)), rebar_state:new(GlobalConfig, Config1); @@ -218,7 +218,7 @@ log_level() -> %% version() -> {ok, Vsn} = application:get_key(rebar, vsn), - ?CONSOLE("rebar ~s on Erlang/OTP ~s Erts ~s~n", + ?CONSOLE("rebar ~s on Erlang/OTP ~s Erts ~s", [Vsn, erlang:system_info(otp_release), erlang:system_info(version)]). diff --git a/src/rebar_base_compiler.erl b/src/rebar_base_compiler.erl index 446fa89..01bb727 100644 --- a/src/rebar_base_compiler.erl +++ b/src/rebar_base_compiler.erl @@ -50,7 +50,7 @@ run(Config, FirstFiles, RestFiles, CompileFn) -> Self = self(), F = fun() -> compile_worker(Self, Config, CompileFn) end, Jobs = rebar_state:get(Config, jobs, 3), - ?DEBUG("Starting ~B compile worker(s)~n", [Jobs]), + ?DEBUG("Starting ~B compile worker(s)", [Jobs]), Pids = [spawn_monitor(F) || _I <- lists:seq(1,Jobs)], compile_queue(Config, Pids, RestFiles) end. @@ -135,17 +135,17 @@ compile_each([], _Config, _CompileFn) -> compile_each([Source | Rest], Config, CompileFn) -> case compile(Source, Config, CompileFn) of ok -> - ?DEBUG("~sCompiled ~s\n", [rebar_utils:indent(1), filename:basename(Source)]); + ?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]); {ok, Warnings} -> report(Warnings), - ?DEBUG("~sCompiled ~s\n", [rebar_utils:indent(1), filename:basename(Source)]); + ?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]); skipped -> - ?DEBUG("~sSkipped ~s\n", [rebar_utils:indent(1), filename:basename(Source)]); + ?DEBUG("~sSkipped ~s", [rebar_utils:indent(1), filename:basename(Source)]); Error -> - ?INFO("Compiling ~s failed:\n", + ?INFO("Compiling ~s failed:", [maybe_absname(Config, Source)]), maybe_report(Error), - ?DEBUG("Compilation failed: ~p\n", [Error]), + ?DEBUG("Compilation failed: ~p", [Error]), ?FAIL end, compile_each(Rest, Config, CompileFn). @@ -165,30 +165,30 @@ compile_queue(Config, Pids, Targets) -> end; {fail, {_, {source, Source}}=Error} -> - ?ERROR("Compiling ~s failed:\n", + ?ERROR("Compiling ~s failed:", [maybe_absname(Config, Source)]), maybe_report(Error), - ?DEBUG("Worker compilation failed: ~p\n", [Error]), + ?DEBUG("Worker compilation failed: ~p", [Error]), ?FAIL; {compiled, Source, Warnings} -> report(Warnings), - ?DEBUG("~sCompiled ~s\n", [rebar_utils:indent(1), filename:basename(Source)]), + ?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]), compile_queue(Config, Pids, Targets); {compiled, Source} -> - ?DEBUG("~sCompiled ~s\n", [rebar_utils:indent(1), filename:basename(Source)]), + ?DEBUG("~sCompiled ~s", [rebar_utils:indent(1), filename:basename(Source)]), compile_queue(Config, Pids, Targets); {skipped, Source} -> - ?DEBUG("~sSkipped ~s~n", [rebar_utils:indent(1), filename:basename(Source)]), + ?DEBUG("~sSkipped ~s", [rebar_utils:indent(1), filename:basename(Source)]), compile_queue(Config, Pids, Targets); {'DOWN', Mref, _, Pid, normal} -> - ?DEBUG("Worker exited cleanly\n", []), + ?DEBUG("Worker exited cleanly", []), Pids2 = lists:delete({Pid, Mref}, Pids), compile_queue(Config, Pids2, Targets); {'DOWN', _Mref, _, _Pid, Info} -> - ?DEBUG("Worker failed: ~p\n", [Info]), + ?DEBUG("Worker failed: ~p", [Info]), ?FAIL end. @@ -231,7 +231,7 @@ format_warnings(Config, Source, Warnings, Opts) -> maybe_report({{error, {error, _Es, _Ws}=ErrorsAndWarnings}, {source, _}}) -> maybe_report(ErrorsAndWarnings); maybe_report([{error, E}, {source, S}]) -> - report(["unexpected error compiling " ++ S, io_lib:fwrite("~n~p~n", [E])]); + report(["unexpected error compiling " ++ S, io_lib:fwrite("~n~p", [E])]); maybe_report({error, Es, Ws}) -> report(Es), report(Ws); @@ -250,13 +250,13 @@ format_errors(Config, _MainSource, Extra, Errors) -> format_error(AbsSource, Extra, {{Line, Column}, Mod, Desc}) -> ErrorDesc = Mod:format_error(Desc), - ?FMT("~s:~w:~w: ~s~s~n", [AbsSource, Line, Column, Extra, ErrorDesc]); + ?FMT("~s:~w:~w: ~s~s", [AbsSource, Line, Column, Extra, ErrorDesc]); format_error(AbsSource, Extra, {Line, Mod, Desc}) -> ErrorDesc = Mod:format_error(Desc), - ?FMT("~s:~w: ~s~s~n", [AbsSource, Line, Extra, ErrorDesc]); + ?FMT("~s:~w: ~s~s", [AbsSource, Line, Extra, ErrorDesc]); format_error(AbsSource, Extra, {Mod, Desc}) -> ErrorDesc = Mod:format_error(Desc), - ?FMT("~s: ~s~s~n", [AbsSource, Extra, ErrorDesc]). + ?FMT("~s: ~s~s", [AbsSource, Extra, ErrorDesc]). maybe_absname(Config, Filename) -> case rebar_utils:processing_base_dir(Config) of diff --git a/src/rebar_config.erl b/src/rebar_config.erl index 7ef2488..949d6d4 100644 --- a/src/rebar_config.erl +++ b/src/rebar_config.erl @@ -53,7 +53,7 @@ consult_file(File) -> {ok, Terms} = consult_and_eval(File, Script), Terms; false -> - ?DEBUG("Consult config file ~p~n", [File]), + ?DEBUG("Consult config file ~p", [File]), try_consult(File) end end. @@ -63,7 +63,7 @@ consult_file(File) -> %% =================================================================== consult_and_eval(File, Script) -> - ?DEBUG("Evaluating config script ~p~n", [Script]), + ?DEBUG("Evaluating config script ~p", [Script]), StateData = try_consult(File), file:script(Script, bs([{'CONFIG', StateData}, {'SCRIPT', Script}])). @@ -77,7 +77,7 @@ try_consult(File) -> {error, enoent} -> []; {error, Reason} -> - ?ABORT("Failed to read config file ~s: ~p~n", [File, Reason]) + ?ABORT("Failed to read config file ~s: ~p", [File, Reason]) end. bs(Vars) -> diff --git a/src/rebar_cover_utils.erl b/src/rebar_cover_utils.erl index 24c769a..7de9d48 100644 --- a/src/rebar_cover_utils.erl +++ b/src/rebar_cover_utils.erl @@ -84,7 +84,7 @@ init(true, BeamFiles, TargetDir) -> case [Module || {_, {ok, Module}} <- Compiled] of [] -> %% No modules compiled successfully...fail - ?ERROR("Cover failed to compile any modules; aborting.~n", []), + ?ERROR("Cover failed to compile any modules; aborting.", []), ?FAIL; _ -> %% At least one module compiled successfully @@ -236,12 +236,12 @@ print_coverage(Coverage) -> end, 0, Coverage) * -1, %% Print the output the console - ?CONSOLE("~nCode Coverage:~n", []), + ?CONSOLE("~nCode Coverage:", []), lists:foreach(fun({Mod, C, N}) -> - ?CONSOLE("~*s : ~4s~n", + ?CONSOLE("~*s : ~4s", [Width, Mod, percentage(C, N)]) end, Coverage), - ?CONSOLE("~n~*s : ~s~n", [Width, "Total", TotalCoverage]). + ?CONSOLE("~n~*s : ~s", [Width, "Total", TotalCoverage]). cover_file(Module, TargetDir) -> filename:join([TargetDir, atom_to_list(Module) ++ ".COVER.html"]). @@ -250,9 +250,9 @@ export_coverdata(TargetDir) -> ExportFile = filename:join(TargetDir, "cover.coverdata"), case cover:export(ExportFile) of ok -> - ?CONSOLE("Coverdata export: ~s~n", [ExportFile]); + ?CONSOLE("Coverdata export: ~s", [ExportFile]); {error, Reason} -> - ?ERROR("Coverdata export failed: ~p~n", [Reason]) + ?ERROR("Coverdata export failed: ~p", [Reason]) end. percentage(0, 0) -> diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 9a82e3d..504eb81 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -297,7 +297,7 @@ doterl_compile(State, Dir) -> doterl_compile(Config, Dir, MoreSources, ErlOpts) -> OutDir = filename:join(Dir, "ebin"), ErlFirstFilesConf = rebar_state:get(Config, erl_first_modules, []), - ?DEBUG("erl_opts ~p~n", [ErlOpts]), + ?DEBUG("erl_opts ~p", [ErlOpts]), %% Support the src_dirs option allowing multiple directories to %% contain erlang source. This might be used, for example, should %% eunit tests be separated from the core application source. @@ -352,7 +352,7 @@ doterl_compile(Config, Dir, MoreSources, ErlOpts) -> %% handling this in internal_erl_compile, we also avoid extra %% needs_compile/2 calls. FirstErls = ErlFirstFiles ++ uo_merge(OtherFirstErlsDeps, OtherFirstErls), - ?DEBUG("Files to compile first: ~p~n", [FirstErls]), + ?DEBUG("Files to compile first: ~p", [FirstErls]), rebar_base_compiler:run( Config, FirstErls, OtherErls, fun(S, C) -> @@ -411,10 +411,10 @@ needs_compile(Source, Target, Parents) -> check_erlcinfo(_Config, #erlcinfo{vsn=?ERLCINFO_VSN}) -> ok; check_erlcinfo(Config, #erlcinfo{vsn=Vsn}) -> - ?ABORT("~s file version is incompatible. expected: ~b got: ~b~n", + ?ABORT("~s file version is incompatible. expected: ~b got: ~b", [erlcinfo_file(Config), ?ERLCINFO_VSN, Vsn]); check_erlcinfo(Config, _) -> - ?ABORT("~s file is invalid. Please delete before next run.~n", + ?ABORT("~s file is invalid. Please delete before next run.", [erlcinfo_file(Config)]). erlcinfo_file(_Config) -> @@ -492,7 +492,7 @@ restore_erlcinfo(Config) -> error:badarg -> ?ERROR( "Failed (binary_to_term) to restore rebar info file." - " Discard file.~n", []), + " Discard file.", []), ok end; _Err -> @@ -778,7 +778,7 @@ check_file(File) -> log_files(Prefix, Files) -> case Files of [] -> - ?DEBUG("~s: ~p~n", [Prefix, Files]); + ?DEBUG("~s: ~p", [Prefix, Files]); _ -> - ?DEBUG("~s:~n~p~n", [Prefix, Files]) + ?DEBUG("~s:~n~p", [Prefix, Files]) end. diff --git a/src/rebar_git_resource.erl b/src/rebar_git_resource.erl index 1c4ece7..fee619a 100644 --- a/src/rebar_git_resource.erl +++ b/src/rebar_git_resource.erl @@ -28,7 +28,7 @@ needs_update(Dir, {git, Url, {tag, Tag}}) -> [{cd, Dir}]), Current1 = string:strip(string:strip(Current, both, $\n), both, $\r), CurrentUrl1 = string:strip(string:strip(CurrentUrl, both, $\n), both, $\r), - ?DEBUG("Comparing git tag ~s with ~s and url ~s with ~s~n", [Tag, Current1, Url, CurrentUrl1]), + ?DEBUG("Comparing git tag ~s with ~s and url ~s with ~s", [Tag, Current1, Url, CurrentUrl1]), not ((Current1 =:= Tag) andalso (CurrentUrl1 =:= Url)); needs_update(Dir, {git, Url, {branch, Branch}}) -> {ok, CurrentUrl} = rebar_utils:sh(?FMT("git config --get remote.origin.url", []), @@ -37,7 +37,7 @@ needs_update(Dir, {git, Url, {branch, Branch}}) -> [{cd, Dir}]), Current1 = string:strip(string:strip(Current, both, $\n), both, $\r), CurrentUrl1 = string:strip(string:strip(CurrentUrl, both, $\n), both, $\r), - ?DEBUG("Comparing git branch ~s with ~s and url ~s with ~s~n", [Branch, Current1, Url, CurrentUrl1]), + ?DEBUG("Comparing git branch ~s with ~s and url ~s with ~s", [Branch, Current1, Url, CurrentUrl1]), not ((Current1 =:= Branch) andalso (CurrentUrl1 =:= Url)); needs_update(Dir, {git, Url, Ref}) -> case Ref of @@ -52,14 +52,14 @@ needs_update(Dir, {git, Url, Ref}) -> [{cd, Dir}]), Current1 = string:strip(string:strip(Current, both, $\n), both, $\r), CurrentUrl1 = string:strip(string:strip(CurrentUrl, both, $\n), both, $\r), - ?DEBUG("Comparing git ref ~s with ~s and url ~s with ~s~n", [Ref1, Current1, Url, CurrentUrl1]), + ?DEBUG("Comparing git ref ~s with ~s and url ~s with ~s", [Ref1, Current1, Url, CurrentUrl1]), not ((Current1 =:= Ref1) andalso (CurrentUrl1 =:= Url)). download(Dir, {git, Url}) -> - ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.~n", []), + ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []), download(Dir, {git, Url, {branch, "master"}}); download(Dir, {git, Url, ""}) -> - ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.~n", []), + ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []), download(Dir, {git, Url, {branch, "master"}}); download(Dir, {git, Url, {branch, Branch}}) -> ok = filelib:ensure_dir(Dir), @@ -77,7 +77,7 @@ download(Dir, {git, Url, {ref, Ref}}) -> [{cd, filename:dirname(Dir)}]), rebar_utils:sh(?FMT("git checkout -q ~s", [Ref]), [{cd, Dir}]); download(Dir, {git, Url, Rev}) -> - ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.~n", []), + ?WARN("WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.", []), ok = filelib:ensure_dir(Dir), rebar_utils:sh(?FMT("git clone -n ~s ~s", [Url, filename:basename(Dir)]), [{cd, filename:dirname(Dir)}]), diff --git a/src/rebar_log.erl b/src/rebar_log.erl index 787e5bc..06cfa9c 100644 --- a/src/rebar_log.erl +++ b/src/rebar_log.erl @@ -57,7 +57,7 @@ set_level(Level) -> log(Level, Str, Args) -> {ok, LogState} = application:get_env(rebar, log), - ec_cmd_log:Level(LogState, Str, Args). + ec_cmd_log:Level(LogState, Str++"~n", Args). error_level() -> ?ERROR_LEVEL. default_level() -> ?INFO_LEVEL. diff --git a/src/rebar_otp_app.erl b/src/rebar_otp_app.erl index 14a01d7..e1a1eab 100644 --- a/src/rebar_otp_app.erl +++ b/src/rebar_otp_app.erl @@ -68,7 +68,7 @@ compile(Config, App) -> {ok, rebar_app_info:original_vsn(App1, AppVsn)} end; {error, Reason} -> - ?ABORT("Failed to load app file ~s: ~p\n", [AppFile, Reason]) + ?ABORT("Failed to load app file ~s: ~p", [AppFile, Reason]) end. clean(_Config, File) -> @@ -102,7 +102,7 @@ info_help(Description) -> "~s.~n" "~n" "Valid rebar.config options:~n" - " ~p~n", + " ~p", [ Description, {validate_app_modules, true} @@ -139,17 +139,17 @@ preprocess(Config, Dir, AppSrcFile) -> {Config2, AppFile}; {error, Reason} -> - ?ABORT("Failed to read ~s for preprocessing: ~p\n", + ?ABORT("Failed to read ~s for preprocessing: ~p", [AppSrcFile, Reason]) end. load_app_vars(Config) -> case rebar_state:get(Config, app_vars_file, undefined) of undefined -> - ?DEBUG("No app_vars_file defined.\n", []), + ?DEBUG("No app_vars_file defined.", []), []; Filename -> - ?INFO("Loading app vars from ~p\n", [Filename]), + ?INFO("Loading app vars from ~p", [Filename]), {ok, Vars} = file:consult(Filename), Vars end. @@ -169,12 +169,12 @@ validate_name(AppName, File) -> ok; false -> ?ERROR("Invalid ~s: name of application (~p) " - "must match filename.\n", [File, AppName]), + "must match filename.", [File, AppName]), ?FAIL end. validate_modules(_Dir, AppName, undefined) -> - ?ERROR("Missing modules declaration in ~p.app~n", [AppName]), + ?ERROR("Missing modules declaration in ~p.app", [AppName]), ?FAIL; validate_modules(Dir, AppName, Mods) -> @@ -189,10 +189,10 @@ validate_modules(Dir, AppName, Mods) -> [] -> ok; MissingBeams -> - Msg1 = lists:flatten([io_lib:format("\t* ~p\n", [M]) || + Msg1 = lists:flatten([io_lib:format("\t* ~p", [M]) || M <- MissingBeams]), ?ERROR("One or more modules listed in ~p.app are not " - "present in ebin/*.beam:\n~s", [AppName, Msg1]), + "present in ebin/*.beam:~n~s", [AppName, Msg1]), ?FAIL end, diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index d80586d..5495cc9 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -76,7 +76,7 @@ build_apps(State, Apps) -> end, Apps). build(State, AppInfo) -> - ?INFO("Compiling ~s~n", [rebar_app_info:name(AppInfo)]), + ?INFO("Compiling ~s", [rebar_app_info:name(AppInfo)]), rebar_erlc_compiler:compile(State, ec_cnv:to_list(rebar_app_info:dir(AppInfo))), {ok, AppInfo1} = rebar_otp_app:compile(State, AppInfo), AppInfo1. diff --git a/src/rebar_prv_erlydtl_compiler.erl b/src/rebar_prv_erlydtl_compiler.erl index 8d80cdd..18c6e20 100644 --- a/src/rebar_prv_erlydtl_compiler.erl +++ b/src/rebar_prv_erlydtl_compiler.erl @@ -159,7 +159,7 @@ info(help, compile) -> "Build ErlyDtl (*.dtl) sources.~n" "~n" "Valid rebar.config options:~n" - " ~p~n", + " ~p", [ {erlydtl_opts, [{doc_root, "templates"}, {out_dir, "ebin"}, @@ -204,7 +204,7 @@ compile_dtl(Config, Source, Target, DtlOpts) -> " Download the latest tarball release from github~n" " https://github.com/erlydtl/erlydtl/releases~n" " and install it into your erlang library dir~n" - "===============================================~n~n", []), + "===============================================~n", []), ?FAIL; _ -> case needs_compile(Source, Target, DtlOpts) of @@ -234,7 +234,7 @@ do_compile(Config, Source, Target, DtlOpts) -> %% ensure that doc_root and out_dir are defined, %% using defaults if necessary Opts = lists:ukeymerge(1, DtlOpts, Sorted), - ?INFO("Compiling \"~s\" -> \"~s\" with options:~n ~s~n", + ?INFO("Compiling \"~s\" -> \"~s\" with options:~n ~s", [Source, Target, io_lib:format("~p", [Opts])]), case erlydtl:compile_file(ec_cnv:to_list(Source), list_to_atom(module_name(Target)), diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 1607d08..c982467 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -93,7 +93,7 @@ run_eunit(Config, CodePath, SrcErls) -> ok -> ok; _ -> - ?ABORT("One or more eunit tests failed.~n", []) + ?ABORT("One or more eunit tests failed.", []) end, %% Restore code path true = rebar_utils:cleanup_code_path(CodePath), @@ -158,7 +158,7 @@ get_qualified_and_unqualified_tests1([TestName|TestNames], Functions, get_qualified_and_unqualified_tests1(TestNames, Functions, [{M, F}|QualifiedFunctions]); _ -> - ?ABORT("Unsupported test function specification: ~s~n", [TestName]) + ?ABORT("Unsupported test function specification: ~s", [TestName]) end. %% Provide modules which are to be searched for tests. %% Several scenarios are possible: @@ -178,7 +178,7 @@ randomize_suites(Config, Modules) -> randomize_suites1(Modules, Seed) catch error:badarg -> - ?ERROR("Bad random seed provided: ~p~n", [String]), + ?ERROR("Bad random seed provided: ~p", [String]), ?FAIL end end. diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 9d83f18..ce8a7e0 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -271,7 +271,7 @@ maybe_fetch(AppInfo, Update, Seen) -> case not Exists orelse Update of true -> - ?INFO("Fetching ~s~n", [rebar_app_info:name(AppInfo)]), + ?INFO("Fetching ~s", [rebar_app_info:name(AppInfo)]), Source = rebar_app_info:source(AppInfo), case rebar_fetch:download_source(AppDir, Source) of {error, Reason} -> @@ -287,7 +287,7 @@ maybe_fetch(AppInfo, Update, Seen) -> Source = rebar_app_info:source(AppInfo), case rebar_fetch:needs_update(AppDir, Source) of true -> - ?INFO("Updating ~s~n", [rebar_app_info:name(AppInfo)]), + ?INFO("Updating ~s", [rebar_app_info:name(AppInfo)]), case rebar_fetch:download_source(AppDir, Source) of {error, Reason} -> throw(Reason); diff --git a/src/rebar_prv_release.erl b/src/rebar_prv_release.erl index 572f909..f631499 100644 --- a/src/rebar_prv_release.erl +++ b/src/rebar_prv_release.erl @@ -34,13 +34,18 @@ init(State) -> do(State) -> Options = rebar_state:command_args(State), AllOptions = string:join(["release" | Options], " "), - case rebar_state:get(State, relx, []) of - [] -> - relx:main(AllOptions); - Config -> - relx:main([{config, Config}], AllOptions) - end, - {ok, State}. + try + case rebar_state:get(State, relx, []) of + [] -> + relx:main(AllOptions); + Config -> + relx:main([{config, Config}], AllOptions) + end, + {ok, State} + catch + throw:T -> + {error, {rlx_prv_release, T}} + end. -spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}. format_error(Reason, State) -> diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index 24e357b..932cad7 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -100,7 +100,7 @@ info() -> "Start a shell with project and deps preloaded similar to~n'erl -pa ebin -pa deps/*/ebin'.~n". remove_error_handler(0) -> - ?WARN("Unable to remove simple error_logger handler~n", []); + ?WARN("Unable to remove simple error_logger handler", []); remove_error_handler(N) -> case gen_event:delete_handler(error_logger, error_logger, []) of {error, module_not_found} -> ok; @@ -109,7 +109,7 @@ remove_error_handler(N) -> %% Timeout is a period to wait before giving up wait_until_user_started(0) -> - ?ABORT("Timeout exceeded waiting for `user` to register itself~n", []), + ?ABORT("Timeout exceeded waiting for `user` to register itself", []), erlang:error(timeout); wait_until_user_started(Timeout) -> case whereis(user) of diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index b30c517..f5b1bd5 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -310,10 +310,10 @@ write_file(Output, Data, Force) -> ok = filelib:ensure_dir(Output), case {Force, FileExists} of {"1", true} -> - ?INFO("Writing ~s (forcibly overwriting)~n", + ?INFO("Writing ~s (forcibly overwriting)", [Output]); _ -> - ?INFO("Writing ~s~n", [Output]) + ?INFO("Writing ~s", [Output]) end, case file:write_file(Output, Data) of ok -> @@ -423,7 +423,7 @@ execute_template(Files, [{copy, Input, Output} | Rest], TemplateType, Context, Force, ExistingFiles) catch _:_ -> ?ABORT("Failed while processing template instruction " - "{copy, ~s, ~s}~n", [Input, Output]) + "{copy, ~s, ~s}", [Input, Output]) end; execute_template(Files, [{chmod, Mod, File} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) @@ -434,7 +434,7 @@ execute_template(Files, [{chmod, Mod, File} | Rest], TemplateType, Context, Force, ExistingFiles); {error, Reason} -> ?ABORT("Failed while processing template instruction " - "{chmod, ~b, ~s}: ~p~n", [Mod, File, Reason]) + "{chmod, ~b, ~s}: ~p", [Mod, File, Reason]) end; execute_template(Files, [{symlink, Existing, New} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) -> @@ -444,7 +444,7 @@ execute_template(Files, [{symlink, Existing, New} | Rest], TemplateType, Context, Force, ExistingFiles); {error, Reason} -> ?ABORT("Failed while processing template instruction " - "{symlink, ~s, ~s}: ~p~n", [Existing, New, Reason]) + "{symlink, ~s, ~s}: ~p", [Existing, New, Reason]) end; execute_template(Files, [{variables, _} | Rest], TemplateType, TemplateName, Context, Force, ExistingFiles) -> diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 6dfbbed..bd0c8c2 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -223,7 +223,7 @@ deprecated(Old, New, When) -> <<"WARNING: deprecated ~p option used~n" "Option '~p' has been deprecated~n" "in favor of '~p'.~n" - "'~p' will be removed ~s.~n~n">>, + "'~p' will be removed ~s.~n">>, [Old, Old, New, Old, When]). -spec delayed_halt(integer()) -> no_return(). @@ -394,13 +394,13 @@ log_msg_and_abort(Message) -> log_and_abort(Command, {Rc, Output}) -> ?ABORT("sh(~s)~n" "failed with return code ~w and the following output:~n" - "~s~n", [Command, Rc, Output]). + "~s", [Command, Rc, Output]). -spec debug_and_abort(string(), {integer(), string()}) -> no_return(). debug_and_abort(Command, {Rc, Output}) -> ?DEBUG("sh(~s)~n" "failed with return code ~w and the following output:~n" - "~s~n", [Command, Rc, Output]), + "~s", [Command, Rc, Output]), throw(rebar_abort). sh_loop(Port, Fun, Acc) -> -- cgit v1.1