Browse Source

Add support for embedding VCS info into the version data

pull/3/head
Dave Smith 15 years ago
parent
commit
02bc52fc6a
2 changed files with 10 additions and 2 deletions
  1. +5
    -1
      bootstrap
  2. +5
    -1
      src/rebar_core.erl

+ 5
- 1
bootstrap View File

@ -6,6 +6,9 @@ main(Args) ->
%% Get a string repr of build time %% Get a string repr of build time
Built = build_time(), Built = build_time(),
%% Get a string repr of hg changeset
HgInfo = "hg " ++ string:strip(os:cmd("hg identify -i"), both, $\n),
%% Check for force=1 flag to force a rebuild %% Check for force=1 flag to force a rebuild
case lists:member("force=1", Args) of case lists:member("force=1", Args) of
true -> true ->
@ -17,7 +20,8 @@ main(Args) ->
%% Compile all src/*.erl to ebin %% Compile all src/*.erl to ebin
case make:files(filelib:wildcard("src/*.erl"), [{outdir, "ebin"}, {i, "include"}, case make:files(filelib:wildcard("src/*.erl"), [{outdir, "ebin"}, {i, "include"},
{d, 'BUILD_TIME', Built}]) of
{d, 'BUILD_TIME', Built},
{d, 'VCS_INFO', HgInfo}]) of
up_to_date -> up_to_date ->
ok; ok;
error -> error ->

+ 5
- 1
src/rebar_core.erl View File

@ -38,6 +38,10 @@
-define(BUILD_TIME, "undefined"). -define(BUILD_TIME, "undefined").
-endif. -endif.
-ifndef(VCS_INFO).
-define(VCS_INFO, "undefined").
-endif.
%% =================================================================== %% ===================================================================
%% Public API %% Public API
%% =================================================================== %% ===================================================================
@ -231,7 +235,7 @@ version Show version information
%% %%
version() -> version() ->
{ok, Vsn} = application:get_key(rebar, vsn), {ok, Vsn} = application:get_key(rebar, vsn),
?CONSOLE("Version ~s built ~s\n", [Vsn, ?BUILD_TIME]).
?CONSOLE("rebar version: ~s date: ~s vcs: ~s\n", [Vsn, ?BUILD_TIME, ?VCS_INFO]).
%% %%
%% options accepted via getopt %% options accepted via getopt

Loading…
Cancel
Save