Skip to content

Commit 23455af

Browse files
committed
Print git revision with all --version outputs
This uses the output of `git-describe --tags --always --dirty` to create a UID for binaries. This includes last tag, number of commits after last tag, shortened SHA1 checksum and optional dirty flag for uncommited changes. In case of tagged commit, only the tag name is used.
1 parent 7ca835b commit 23455af

37 files changed

+29
-49
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ if(${enable_cbmc_tests})
3838
enable_testing()
3939
endif()
4040

41+
file(STRINGS src/config.inc config_inc_v REGEX "CBMC_VERSION *= *[0-9\.]+")
42+
string(REGEX REPLACE "^CBMC_VERSION *= *" "" CBMC_RELEASE ${config_inc_v})
43+
message(STATUS "CBMC release ${CBMC_RELEASE}")
44+
4145
find_package(Git)
4246

4347
macro(git_revision target files_var)

jbmc/src/janalyzer/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ CLEANFILES = janalyzer$(EXEEXT)
3333

3434
all: janalyzer$(EXEEXT)
3535

36+
CP_CXXFLAGS += -DCBMC_VERSION="\"$(CBMC_VERSION) ($(GIT_INFO))\""
37+
3638
ifneq ($(wildcard ../jsil/Makefile),)
3739
OBJ += ../jsil/jsil$(LIBEXT)
3840
CP_CXXFLAGS += -DHAVE_JSIL

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ Author: Daniel Kroening, [email protected]
5050
#include <util/options.h>
5151
#include <util/unicode.h>
5252

53-
#include <cbmc/version.h>
54-
5553
#include <goto-analyzer/static_show_domain.h>
5654
#include <goto-analyzer/static_simplifier.h>
5755
#include <goto-analyzer/static_verifier.h>

jbmc/src/janalyzer/module_dependencies.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
analyses
22
ansi-c # should go away
3-
cbmc # version.h
43
java_bytecode
54
jdiff
65
goto-analyzer

jbmc/src/jbmc/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ CLEANFILES = jbmc$(EXEEXT)
6363

6464
all: jbmc$(EXEEXT)
6565

66+
CP_CXXFLAGS += -DCBMC_VERSION="\"$(CBMC_VERSION) ($(GIT_INFO))\""
67+
6668
###############################################################################
6769

6870
jbmc$(EXEEXT): $(OBJ)

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ Author: Daniel Kroening, [email protected]
6060
#include <java_bytecode/replace_java_nondet.h>
6161
#include <java_bytecode/simple_method_stubbing.h>
6262

63-
#include <cbmc/version.h>
64-
6563
jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv):
6664
parse_options_baset(JBMC_OPTIONS, argc, argv),
6765
messaget(ui_message_handler),

jbmc/src/jbmc/module_dependencies.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
analyses
22
ansi-c # should go away
3-
cbmc # version.h and bmc.h
3+
cbmc # bmc.h
44
goto-instrument
55
goto-programs
66
goto-symex

jbmc/src/jdiff/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ CLEANFILES = jdiff$(EXEEXT)
4545

4646
all: jdiff$(EXEEXT)
4747

48+
CP_CXXFLAGS += -DCBMC_VERSION="\"$(CBMC_VERSION) ($(GIT_INFO))\""
49+
4850
###############################################################################
4951

5052
jdiff$(EXEEXT): $(OBJ)

jbmc/src/jdiff/jdiff_parse_options.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ Author: Peter Schrammel
5555

5656
#include <langapi/mode.h>
5757

58-
#include <cbmc/version.h>
59-
6058
#include "java_syntactic_diff.h"
6159
#include <goto-diff/change_impact.h>
6260
#include <goto-diff/goto_diff.h>

jbmc/src/jdiff/module_dependencies.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
analyses
2-
cbmc # version.h
32
java_bytecode
43
jdiff
54
goto-diff

0 commit comments

Comments
 (0)