From ffa0cda467ce851ff57aa23b92ab8f3fd679fb33 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Mon, 7 Dec 2009 16:03:56 -0700 Subject: Updating bootstrap to embed the build time into a macro that we can pull via "version" command --- bootstrap | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bootstrap') 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])). + -- cgit v1.1