summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2009-12-07 16:03:56 -0700
committerDave Smith <dizzyd@dizzyd.com>2009-12-07 16:03:56 -0700
commitffa0cda467ce851ff57aa23b92ab8f3fd679fb33 (patch)
treebb7617149d8c3d73b33c4864157a233d0fd63cf8 /bootstrap
parent95d52f860df1be7d2df5d7fce0c499ec4832add9 (diff)
downloadrebar-ffa0cda467ce851ff57aa23b92ab8f3fd679fb33.tar.gz
Updating bootstrap to embed the build time into a macro that we can pull via "version" command
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap20
1 files changed, 18 insertions, 2 deletions
diff --git a/bootstrap b/bootstrap
index 237c5b2..37145aa 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,8 +2,21 @@
%% -*- erlang -*-
main(Args) ->
+ %% Get a string repr of build time
+ Built = build_time(),
+
+ %% Check for force=1 flag to force a rebuild
+ case lists:member("force=1", Args) of
+ true ->
+ [] = os:cmd("rm -rf ebin/*.beam"),
+ ok;
+ false ->
+ ok
+ end,
+
%% Compile all src/*.erl to ebin
- case make:files(filelib:wildcard("src/*.erl"), [{outdir, "ebin"}, {i, "include"}]) of
+ case make:files(filelib:wildcard("src/*.erl"), [{outdir, "ebin"}, {i, "include"},
+ {d, 'BUILD_TIME', Built}]) of
up_to_date ->
ok;
error ->
@@ -55,5 +68,8 @@ main(Args) ->
"and you can use rebar to build OTP-compliant apps.\n").
-
+build_time() ->
+ {{Y, M, D}, {H, Min, S}} = calendar:now_to_universal_time(now()),
+ lists:flatten(io_lib:format("~4..0w~2..0w~2..0w_~2..0w~2..0w~2..0w", [Y, M, D, H, Min, S])).
+