Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exposes git commit ID in the bap version #1071

Merged
merged 11 commits into from
Mar 3, 2020
3 changes: 3 additions & 0 deletions lib/bap_main/bap_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,9 @@ let init
List.partition_map result ~f:(function
| Ok p -> `Fst p
| Error (p,e) -> `Snd (p,e)) in
let version = match Bap_main_config.build_id with
| "" -> version
| id -> sprintf "%s+%s" version id in
if List.is_empty failures
then match Grammar.eval argv
?name ~version ?env ?help:out
Expand Down
1 change: 1 addition & 0 deletions lib/bap_main/bap_main_config.ml.ab
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ let suffix_program = "$suffix_program"
let debug = "$debug"
let profile = "$profile"
let standard_library = "$standard_library"
let build_id = "$build_id"
14 changes: 14 additions & 0 deletions oasis/main.setup.ml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

let () =
add_variable "build_id"
~doc:"Adds a build id to bap version"
~define:(function
| Some x -> x
| None ->
try
if Sys.file_exists ".git" && Sys.is_directory ".git" then
OASISExec.run_read_one_line ~ctxt
~f_exit_code:ignore
"git" ["rev-parse"; "--verify"; "--quiet"; "--short=7"; "HEAD"; ]
else ""
with _ -> "")