diff options
author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2015-04-16 16:47:26 +0200 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2015-04-16 16:55:09 +0200 |
commit | 5809ba1ef2ca3fdc4d68b8ac411792c7dd0089b3 (patch) | |
tree | b9c75d5e2191514b5d685e7d63f6bd1470ce8b96 /bootstrap | |
parent | 04d2634f87a861ca7c0bec9b059f90e4918e0576 (diff) | |
download | rebar-5809ba1ef2ca3fdc4d68b8ac411792c7dd0089b3.tar.gz |
bootstrap: better warning fix (Thanks James Fish)
As a follow-up to bad3a795, implement a better fix for the pre-18.0
warning.
erlang:now/0 was deprecated in 18.0, and as the escript has to pass
erl_lint:module/1 (even without -mode(compile)), we would see a
deprecation warning for erlang:now/1. One solution is to use
-compile({nowarn_deprecated_function, [{erlang, now, 0}]}), but that
would raise a warning in versions older than 18.0. Calling erlang:now/0
via apply/3 avoids that.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -124,16 +124,18 @@ build_time() -> {{Y, M, D}, {H, Min, S}} = calendar:now_to_universal_time(rebar_now()), lists:flatten(io_lib:format("~4..0w~2..0w~2..0w_~2..0w~2..0w~2..0w", [Y, M, D, H, Min, S])). - -%% Even though we don't have -mode(compile), erl_lint:module/1 is run in -%% escript, so we still have to silence the deprecation warning. --compile({nowarn_deprecated_function, [{erlang, now, 0}]}). rebar_now() -> case erlang:function_exported(erlang, timestamp, 0) of true -> erlang:timestamp(); false -> - now() + %% erlang:now/0 was deprecated in 18.0, and as the escript has to + %% pass erl_lint:module/1 (even without -mode(compile)), we would + %% see a deprecation warning for erlang:now/1. One solution is to + %% use -compile({nowarn_deprecated_function, [{erlang, now, 0}]}), + %% but that would raise a warning in versions older than 18.0. + %% Calling erlang:now/0 via apply/3 avoids that. + apply(erlang, now, []) end. vcs_info([]) -> |