chore(build): write rendered rebar.config only when debugging

This commit is contained in:
Zaiming Shi 2021-03-02 20:37:45 +01:00
parent e3407b9556
commit c61080c862
1 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,7 @@
do(_Dir, CONFIG) -> do(_Dir, CONFIG) ->
C1 = deps(CONFIG), C1 = deps(CONFIG),
Config = dialyzer(C1), Config = dialyzer(C1),
dump(Config ++ [{overrides, overrides()}] ++ coveralls() ++ config()). maybe_dump(Config ++ [{overrides, overrides()}] ++ coveralls() ++ config()).
bcrypt() -> bcrypt() ->
{bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}. {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {branch, "0.6.0"}}}.
@ -286,10 +286,19 @@ get_vsn() ->
Vsn2 = re:replace(PkgVsn, "v", "", [{return ,list}]), Vsn2 = re:replace(PkgVsn, "v", "", [{return ,list}]),
re:replace(Vsn2, "\n", "", [{return ,list}]). re:replace(Vsn2, "\n", "", [{return ,list}]).
dump(Config) -> maybe_dump(Config) ->
file:write_file("rebar.config.rendered", [io_lib:format("~p.\n", [I]) || I <- Config]), is_debug() andalso file:write_file("rebar.config.rendered", [io_lib:format("~p.\n", [I]) || I <- Config]),
Config. Config.
is_debug() -> is_debug("DEBUG") orelse is_debug("DIAGNOSTIC").
is_debug(VarName) ->
case os:getenv(VarName) of
false -> false;
"" -> false;
_ -> true
end.
provide_bcrypt_dep() -> provide_bcrypt_dep() ->
case os:type() of case os:type() of
{win32, _} -> false; {win32, _} -> false;