summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ebin/rebar.app2
-rwxr-xr-xpriv/templates/simplenode.runner4
-rw-r--r--rebar.config.sample8
-rw-r--r--src/rebar.erl24
-rw-r--r--src/rebar_appups.erl17
-rw-r--r--src/rebar_core.erl21
-rw-r--r--src/rebar_dialyzer.erl225
-rw-r--r--src/rebar_port_compiler.erl55
-rw-r--r--src/rebar_reltool.erl2
-rw-r--r--src/rebar_upgrade.erl5
10 files changed, 81 insertions, 282 deletions
diff --git a/ebin/rebar.app b/ebin/rebar.app
index a6bb69a..987db97 100644
--- a/ebin/rebar.app
+++ b/ebin/rebar.app
@@ -14,7 +14,6 @@
rebar_cleaner,
rebar_ct,
rebar_deps,
- rebar_dialyzer,
rebar_asn1_compiler,
rebar_edoc,
rebar_erlc_compiler,
@@ -73,7 +72,6 @@
rebar_otp_app,
rebar_ct,
rebar_eunit,
- rebar_dialyzer,
rebar_escripter,
rebar_edoc,
rebar_xref
diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner
index a2cdd79..4b1efa2 100755
--- a/priv/templates/simplenode.runner
+++ b/priv/templates/simplenode.runner
@@ -23,14 +23,14 @@ cd $RUNNER_BASE_DIR
mkdir -p $RUNNER_LOG_DIR
# Extract the target node name from node.args
-NAME_ARG=`grep -e '-[s]*name' $RUNNER_ETC_DIR/vm.args`
+NAME_ARG=`egrep -e '^-s?name' $RUNNER_ETC_DIR/vm.args`
if [ -z "$NAME_ARG" ]; then
echo "vm.args needs to have either -name or -sname parameter."
exit 1
fi
# Extract the target cookie
-COOKIE_ARG=`grep -e '-setcookie' $RUNNER_ETC_DIR/vm.args`
+COOKIE_ARG=`grep -e '^-setcookie' $RUNNER_ETC_DIR/vm.args`
if [ -z "$COOKIE_ARG" ]; then
echo "vm.args needs to have a -setcookie parameter."
exit 1
diff --git a/rebar.config.sample b/rebar.config.sample
index 3a62a0a..0a7fb11 100644
--- a/rebar.config.sample
+++ b/rebar.config.sample
@@ -86,14 +86,6 @@
%% Option to pass extra parameters when launching Common Test
{ct_extra_params, "-boot start_sasl -s myapp"}.
-%% == Dialyzer ==
-
-%% Options for running dialyzer
-%% {plt, PltFile}
-%% 'src': run Dialyzer on the source files as in 'dialyzer --src'
-%% {warnings, [WarnOpts]}: turn on/off Dialyzer warnings
-{dialyzer_opts, [{plt, PltFile}, {warnings, [WarnOpts]}, src]}.
-
%% == Cleanup ==
%% Which files to cleanup
diff --git a/src/rebar.erl b/src/rebar.erl
index 36114cf..a1b51aa 100644
--- a/src/rebar.erl
+++ b/src/rebar.erl
@@ -203,10 +203,6 @@ show_info_maybe_halt(O, Opts, F) ->
%%
commands() ->
S = <<"
-dialyze Analyze with Dialyzer
-build-plt Build Dialyzer PLT
-check-plt Check Dialyzer PLT
-
clean Clean
compile Compile sources
@@ -278,8 +274,8 @@ filter_flags([Item | Rest], Commands) ->
command_names() ->
["build-plt", "check-deps", "check-plt", "clean", "compile", "create",
- "create-app", "create-node", "ct", "delete-deps", "dialyze", "doc",
- "eunit", "generate", "generate-appups", "generate-upgrade", "get-deps",
+ "create-app", "create-node", "ct", "delete-deps", "doc", "eunit",
+ "generate", "generate-appups", "generate-upgrade", "get-deps",
"help", "list-templates", "update-deps", "version", "xref"].
unabbreviate_command_names([]) ->
@@ -324,17 +320,15 @@ is_command_name_sub_word_candidate(Command, Candidate) ->
%% Allow for parts of commands to be abbreviated, i.e. create-app
%% can be shortened to "create-a", "c-a" or "c-app" (but not
%% "create-" since that would be ambiguous).
- CommandSubWords = re:split(Command, "-", [{return, list}]),
- CandidateSubWords = re:split(Candidate, "-", [{return, list}]),
+ ReOpts = [{return, list}],
+ CommandSubWords = re:split(Command, "-", ReOpts),
+ CandidateSubWords = re:split(Candidate, "-", ReOpts),
is_command_name_sub_word_candidate_aux(CommandSubWords, CandidateSubWords).
-is_command_name_sub_word_candidate_aux([CmdSW | CmdSWs], [CandSW | CandSWs]) ->
- case lists:prefix(CmdSW, CandSW) of
- true ->
- is_command_name_sub_word_candidate_aux(CmdSWs, CandSWs);
- false ->
- false
- end;
+is_command_name_sub_word_candidate_aux([CmdSW | CmdSWs],
+ [CandSW | CandSWs]) ->
+ lists:prefix(CmdSW, CandSW) andalso
+ is_command_name_sub_word_candidate_aux(CmdSWs, CandSWs);
is_command_name_sub_word_candidate_aux([], []) ->
true;
is_command_name_sub_word_candidate_aux(_CmdSWs, _CandSWs) ->
diff --git a/src/rebar_appups.erl b/src/rebar_appups.erl
index df20e43..871c426 100644
--- a/src/rebar_appups.erl
+++ b/src/rebar_appups.erl
@@ -63,9 +63,7 @@
filename:join([NewName, "lib"]), "^.*.appup$"),
%% Convert the list of appup files into app names
- AppUpApps = lists:map(fun(File) ->
- file_to_name(File)
- end, NewAppUpFiles),
+ AppUpApps = [file_to_name(File) || File <- NewAppUpFiles],
%% Create a list of apps that don't already have appups
UpgradeApps = genappup_which_apps(Upgraded, AppUpApps),
@@ -115,7 +113,7 @@ upgraded_app(_, _, _) ->
app_list_diff(List1, List2) ->
List3 = lists:umerge(lists:sort(proplists:get_keys(List1)),
lists:sort(proplists:get_keys(List2))),
- lists:subtract(List3, proplists:get_keys(List2)).
+ List3 -- proplists:get_keys(List2).
file_to_name(File) ->
filename:rootname(filename:basename(File)).
@@ -180,13 +178,10 @@ generate_instruction_advanced(Name, _, _) ->
get_behavior(List) ->
Attributes = proplists:get_value(attributes, List),
- Behavior = case proplists:get_value(behavior, Attributes) of
- undefined ->
- proplists:get_value(behaviour, Attributes);
- Else ->
- Else
- end,
- Behavior.
+ case proplists:get_value(behavior, Attributes) of
+ undefined -> proplists:get_value(behaviour, Attributes);
+ Else -> Else
+ end.
is_code_change(List) ->
Exports = proplists:get_value(exports, List),
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index f17ed0b..cb2c508 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -148,9 +148,17 @@ process_dir(Dir, ParentConfig, Command, DirSet) ->
%% in preprocess.
{ok, PluginModules} = plugin_modules(Config),
+ %% Execute any before_command plugins on this directory
+ execute_pre(Command, PluginModules,
+ Config, ModuleSetFile),
+
%% Execute the current command on this directory
execute(Command, Modules ++ PluginModules,
- Config, ModuleSetFile)
+ Config, ModuleSetFile),
+
+ %% Execute any after_command plugins on this directory
+ execute_post(Command, PluginModules,
+ Config, ModuleSetFile)
end,
%% Mark the current directory as processed
@@ -215,6 +223,17 @@ is_dir_type(rel_dir, Dir) ->
is_dir_type(_, _) ->
false.
+execute_pre(Command, Modules, Config, ModuleFile) ->
+ execute_plugin_hook("pre_", Command, Modules,
+ Config, ModuleFile).
+
+execute_post(Command, Modules, Config, ModuleFile) ->
+ execute_plugin_hook("post_", Command, Modules,
+ Config, ModuleFile).
+
+execute_plugin_hook(Hook, Command, Modules, Config, ModuleFile) ->
+ HookFunction = list_to_atom(Hook ++ atom_to_list(Command)),
+ execute(HookFunction, Modules, Config, ModuleFile).
%%
%% Execute a command across all applicable modules
diff --git a/src/rebar_dialyzer.erl b/src/rebar_dialyzer.erl
deleted file mode 100644
index b624a44..0000000
--- a/src/rebar_dialyzer.erl
+++ /dev/null
@@ -1,225 +0,0 @@
-%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ts=4 sw=4 et
-%% -------------------------------------------------------------------
-%%
-%% rebar: Erlang Build Tools
-%%
-%% Copyright (c) 2010 Dave Smith (dizzyd@dizzyd.com)
-%%
-%% 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.
-%% -------------------------------------------------------------------
-%% @author Dave Smith <dizzyd@dizzyd.com>
-%% @doc rebar_dialyzer supports the following commands:
-%% <ul>
-%% <li>dialyze (essentially "dialyzer ebin" or "dialyzer --src src")</li>
-%% <li>build-plt (essentially "dialyzer --build_plt -r &lt;app_dirs&gt;")</li>
-%% <li>check-plt (essentially "dialyzer --check_plt")</li>
-%% </ul>
-%% A single option <code>plt</code> can be presented in the
-%% <code>dialyzer_opts</code> options in <code>rebar.config</code>. If it
-%% is present, it is used as the PLT for the supported commands. Should it
-%% not be present, then the default is <code>$HOME/.dialyzer_plt</code> or
-%% <code>$REBAR_PLT_DIR/.dialyzer_plt</code> if $REBAR_PLT_DIR is defined.
-%%
-%% @reference <a href="http://user.it.uu.se/~kostis/Papers/bugs05.pdf">
-%% Experience from developing the Dialyzer: A static analysis tool detecting
-%% defects in Erlang applications</a>
-%% @reference <a href="http://user.it.uu.se/~kostis/Papers/contracts.pdf">
-%% A Language for Specifying Type Contracts in Erlang and its Interaction
-%% with Success Typings</a>
-%% @reference <a href="http://user.it.uu.se/~kostis/Papers/wrangler.pdf">Gradual
-%% Typing of Erlang Programs: A Wrangler Experience</a>
-%% @copyright 2010 Dave Smith
-%% -------------------------------------------------------------------
--module(rebar_dialyzer).
-
--export([dialyze/2,
- 'build-plt'/2,
- 'check-plt'/2]).
-
--include("rebar.hrl").
-
--type warning() :: {atom(), {string(), integer()}, any()}.
-
-%% ===================================================================
-%% Public API
-%% ===================================================================
-
-%% @doc Perform static analysis on the contents of the ebin directory.
--spec dialyze(Config::rebar_config:config(), File::file:filename()) -> ok.
-dialyze(Config, File) ->
- Plt = existing_plt_path(Config, File),
- case dialyzer:plt_info(Plt) of
- {ok, _} ->
- FromSrc = proplists:get_bool(src, rebar_config:get(Config,
- dialyzer_opts,
- [])),
- DialyzerOpts0 = case FromSrc of
- true ->
- [{files_rec, ["src"]}, {init_plt, Plt},
- {from, src_code}];
- false ->
- [{files_rec, ["ebin"]}, {init_plt, Plt}]
- end,
- WarnOpts = warnings(Config),
- DialyzerOpts = case WarnOpts of
- [] -> DialyzerOpts0;
- _ -> [{warnings, WarnOpts}|DialyzerOpts0]
- end,
- ?DEBUG("DialyzerOpts: ~p~n", [DialyzerOpts]),
- try dialyzer:run(DialyzerOpts) of
- [] ->
- ok;
- Warnings ->
- print_warnings(Warnings)
- catch
- throw:{dialyzer_error, Reason} ->
- ?ABORT("~s~n", [Reason])
- end;
- {error, no_such_file} ->
- ?ABORT("The PLT ~s does not exist. Please perform the build-plt "
- "command to ~n"
- "produce the initial PLT. Be aware that this operation may "
- "take several minutes.~n", [Plt]);
- {error, read_error} ->
- ?ABORT("Unable to read PLT ~n~n", [Plt]);
- {error, not_valid} ->
- ?ABORT("The PLT ~s is not valid.~n", [Plt])
- end,
- ok.
-
-%% @doc Build the PLT.
--spec 'build-plt'(Config::rebar_config:config(), File::file:filename()) -> ok.
-'build-plt'(Config, File) ->
- Plt = new_plt_path(Config, File),
-
- Apps = rebar_app_utils:app_applications(File),
-
- ?DEBUG("Build PLT ~s including following apps:~n~p~n", [Plt, Apps]),
- Warnings = dialyzer:run([{analysis_type, plt_build},
- {files_rec, app_dirs(Apps)},
- {output_plt, Plt}]),
- case Warnings of
- [] ->
- ?INFO("The built PLT can be found in ~s~n", [Plt]);
- _ ->
- print_warnings(Warnings)
- end,
- ok.
-
-%% @doc Check whether the PLT is up-to-date.
--spec 'check-plt'(Config::rebar_config:config(), File::file:filename()) -> ok.
-'check-plt'(Config, File) ->
- Plt = existing_plt_path(Config, File),
- try dialyzer:run([{analysis_type, plt_check}, {init_plt, Plt}]) of
- [] ->
- ?CONSOLE("The PLT ~s is up-to-date~n", [Plt]);
- _ ->
- %% @todo Determine whether this is the correct summary.
- ?ABORT("The PLT ~s is not up-to-date~n", [Plt])
- catch
- throw:{dialyzer_error, _Reason} ->
- ?ABORT("The PLT ~s is not valid.~n", [Plt])
- end,
- ok.
-
-%% ===================================================================
-%% Internal functions
-%% ===================================================================
-
-%% @doc Obtain the library paths for the supplied applications.
--spec app_dirs(Apps::[atom()]) -> [file:filename()].
-app_dirs(Apps) ->
- [filename:join(Path, "ebin")
- || Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
-
-%% @doc Render the warnings on the console.
--spec print_warnings(Warnings::[warning(), ...]) -> no_return().
-print_warnings(Warnings) ->
- lists:foreach(fun(Warning) ->
- ?CONSOLE("~s", [dialyzer:format_warning(Warning)])
- end, Warnings),
- ?FAIL.
-
-%% @doc If the plt option is present in rebar.config return its value,
-%% otherwise return $HOME/.dialyzer_plt or $REBAR_PLT_DIR/.dialyzer_plt.
--spec new_plt_path(Config::rebar_config:config(),
- File::file:filename()) -> file:filename().
-new_plt_path(Config, File) ->
- AppName = rebar_app_utils:app_name(File),
- DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
- case proplists:get_value(plt, DialyzerOpts) of
- undefined ->
- case os:getenv("REBAR_PLT_DIR") of
- false ->
- filename:join(os:getenv("HOME"),
- "." ++ atom_to_list(AppName)
- ++ "_dialyzer_plt");
- PltDir ->
- filename:join(PltDir, "." ++ atom_to_list(AppName)
- ++ "_dialyzer_plt")
- end;
- Plt ->
- Plt
- end.
-
-%% @doc If the plt option is present in rebar.config and the file exists
-%% return its value or if $HOME/.AppName_dialyzer_plt exists return that.
-%% Otherwise return $HOME/.dialyzer_plt if it exists or abort.
-%% If $REBAR_PLT_DIR is defined, it is used instead of $HOME.
--spec existing_plt_path(Config::rebar_config:config(),
- File::file:filename()) -> file:filename().
-existing_plt_path(Config, File) ->
- AppName = rebar_app_utils:app_name(File),
- DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
- Home = os:getenv("HOME"),
- Base = case os:getenv("REBAR_PLT_DIR") of
- false ->
- Home;
- PltDir ->
- PltDir
- end,
- case proplists:get_value(plt, DialyzerOpts) of
- undefined ->
- AppPlt = filename:join(Base, "." ++ atom_to_list(AppName)
- ++ "_dialyzer_plt"),
- case filelib:is_regular(AppPlt) of
- true ->
- AppPlt;
- false ->
- BasePlt = filename:join(Base, ".dialyzer_plt"),
- case filelib:is_regular(BasePlt) of
- true ->
- BasePlt;
- false ->
- ?ABORT("No PLT found~n", [])
- end
- end;
- "~/" ++ Plt ->
- filename:join(Home, Plt);
- Plt ->
- Plt
- end.
-
-%% @doc If the warnings option is present in rebar.config return its value,
-%% otherwise return [].
--spec warnings(Config::rebar_config:config()) -> list().
-warnings(Config) ->
- DialyzerOpts = rebar_config:get(Config, dialyzer_opts, []),
- proplists:get_value(warnings, DialyzerOpts, []).
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 272c151..b9c2ea4 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -62,6 +62,14 @@
%% ERL_LDFLAGS - default -L and -lerl_interface -lei
%% DRV_CFLAGS - flags that will be used for compiling the driver
%% DRV_LDFLAGS - flags that will be used for linking the driver
+%% ERL_EI_LIBDIR - ei library directory
+%% CXX_TEMPLATE - C++ command template
+%% CC_TEMPLATE - C command template
+%% LINK_TEMPLATE - Linker command template
+%% PORT_IN_FILES - contains a space separated list of input
+%% file(s), (used in command template)
+%% PORT_OUT_FILE - contains the output filename (used in
+%% command template)
%%
%% Note that if you wish to extend (vs. replace) these variables,
%% you MUST include a shell-style reference in your definition.
@@ -117,10 +125,10 @@ compile(Config, AppFile) ->
Intersection = sets:intersection(AllBins),
case needs_link(SoName, sets:to_list(Intersection)) of
true ->
- rebar_utils:sh(
- ?FMT("$CC ~s $LDFLAGS $DRV_LDFLAGS -o ~s",
- [string:join(Bins, " "), SoName]),
- [{env, Env}]);
+ Cmd = expand_command("LINK_TEMPLATE", Env,
+ string:join(Bins, " "),
+ SoName),
+ rebar_utils:sh(Cmd, [{env, Env}]);
false ->
?INFO("Skipping relink of ~s\n", [SoName]),
ok
@@ -182,12 +190,13 @@ compile_each([Source | Rest], Config, Env, NewBins, ExistingBins) ->
?CONSOLE("Compiling ~s\n", [Source]),
case compiler(Ext) of
"$CC" ->
- rebar_utils:sh(?FMT("$CC -c $CFLAGS $DRV_CFLAGS ~s -o ~s",
- [Source, Bin]), [{env, Env}]);
+ rebar_utils:sh(expand_command("CC_TEMPLATE", Env,
+ Source, Bin),
+ [{env, Env}]);
"$CXX" ->
- rebar_utils:sh(
- ?FMT("$CXX -c $CXXFLAGS $DRV_CFLAGS ~s -o ~s",
- [Source, Bin]), [{env, Env}])
+ rebar_utils:sh(expand_command("CXX_TEMPLATE", Env,
+ Source, Bin),
+ [{env, Env}])
end,
compile_each(Rest, Config, Env, [Bin | NewBins], ExistingBins);
@@ -302,6 +311,12 @@ expand_vars(Key, Value, Vars) ->
end,
[], Vars).
+expand_command(TmplName, Env, InFiles, OutFile) ->
+ Cmd0 = proplists:get_value(TmplName, Env),
+ Cmd1 = expand_env_variable(Cmd0, "PORT_IN_FILES", InFiles),
+ Cmd2 = expand_env_variable(Cmd1, "PORT_OUT_FILE", OutFile),
+ re:replace(Cmd2, "\\\$\\w+|\\\${\\w+}", "", [global, {return, list}]).
+
%%
%% Given a string, determine if it is expandable
%%
@@ -314,11 +329,14 @@ is_expandable(InStr) ->
%%
%% Given env. variable FOO we want to expand all references to
%% it in InStr. References can have two forms: $FOO and ${FOO}
+%% The end of form $FOO is delimited with whitespace or eol
%%
expand_env_variable(InStr, VarName, VarValue) ->
- R1 = re:replace(InStr, "\\\$" ++ VarName, VarValue),
- re:replace(R1, "\\\${" ++ VarName ++ "}", VarValue, [{return, list}]).
-
+ R1 = re:replace(InStr, "\\\$" ++ VarName ++ "\\s", VarValue ++ " ",
+ [global]),
+ R2 = re:replace(R1, "\\\$" ++ VarName ++ "\$", VarValue),
+ re:replace(R2, "\\\${" ++ VarName ++ "}", VarValue,
+ [global, {return, list}]).
%%
%% Filter a list of env vars such that only those which match the provided
@@ -343,19 +361,26 @@ erts_dir() ->
os_env() ->
Os = [list_to_tuple(re:split(S, "=", [{return, list}, {parts, 2}])) ||
S <- os:getenv()],
- lists:keydelete([],1,Os). %% Remove Windows current disk and path
+ %% Drop variables without a name (win32)
+ [T1 || {K, _V} = T1 <- Os, K =/= []].
default_env() ->
[
+ {"CXX_TEMPLATE",
+ "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"},
+ {"CC_TEMPLATE",
+ "$CC -c $CFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"},
+ {"LINK_TEMPLATE",
+ "$CC $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS -o $PORT_OUT_FILE"},
{"CC", "cc"},
{"CXX", "c++"},
{"ERL_CFLAGS", lists:concat([" -I", code:lib_dir(erl_interface, include),
" -I", filename:join(erts_dir(), "include"),
" "])},
- {"ERL_LDFLAGS", lists:concat([" -L", code:lib_dir(erl_interface, lib),
- " -lerl_interface -lei"])},
+ {"ERL_LDFLAGS", " -L$ERL_EI_LIBDIR -lerl_interface -lei"},
{"DRV_CFLAGS", "-g -Wall -fPIC $ERL_CFLAGS"},
{"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},
+ {"ERL_EI_LIBDIR", code:lib_dir(erl_interface, lib)},
{"darwin", "DRV_LDFLAGS",
"-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
{"ERLANG_ARCH", rebar_utils:wordsize()},
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl
index 5e71814..72bfe49 100644
--- a/src/rebar_reltool.erl
+++ b/src/rebar_reltool.erl
@@ -302,7 +302,7 @@ execute_overlay([{template_wildcard, Wildcard, OutDir} | Rest], Vars, BaseDir, T
[{template, F, filename:join(OutDir, filename:basename(F))} | Acc0]
end,
NewInstrs = lists:foldl(Ifun, Rest, filelib:wildcard(Wildcard, BaseDir)),
- case length(NewInstrs) == length(Rest) of
+ case length(NewInstrs) =:= length(Rest) of
true ->
?WARN("template_wildcard: ~s did not match any files!\n", [Wildcard]);
false ->
diff --git a/src/rebar_upgrade.erl b/src/rebar_upgrade.erl
index 39b2c61..0bf0338 100644
--- a/src/rebar_upgrade.erl
+++ b/src/rebar_upgrade.erl
@@ -81,7 +81,8 @@ run_checks(OldVerPath, ReltoolFile) ->
true = rebar_utils:prop_check(filelib:is_dir(NamePath),
"Release directory doesn't exist (~p)~n", [NamePath]),
- {NewName, NewVer} = rebar_rel_utils:get_rel_release_info(Name, NamePath),
+ {NewName, NewVer} = NewNameAndVer =
+ rebar_rel_utils:get_rel_release_info(Name, NamePath),
{OldName, OldVer} = rebar_rel_utils:get_rel_release_info(Name, OldVerPath),
true = rebar_utils:prop_check(NewName == OldName,
@@ -93,7 +94,7 @@ run_checks(OldVerPath, ReltoolFile) ->
true = rebar_utils:prop_check(Ver == NewVer,
"Reltool and .rel versions do not match~n", []),
- {NewName, NewVer}.
+ NewNameAndVer.
setup(OldVerPath, NewName, NewVer, NameVer) ->
NewRelPath = filename:join([".", NewName]),