[sledge] Change: Improve build info slightly

Reviewed By: ngorogiannis

Differential Revision: D22381643

fbshipit-source-id: ea49a36b2
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent a366b388a9
commit 58dae840d3

@ -14,19 +14,23 @@ let debug =
true ) ;
!d
module B = Build_info.V1
module Build_info = Build_info.V1
let version_to_string v =
Option.value_map ~f:B.Version.to_string v ~default:"dev"
Option.value_map ~f:Build_info.Version.to_string v ~default:"dev"
let version =
version_to_string (B.version ()) ^ if debug then "-dbg" else ""
Format.sprintf "%s%s"
(version_to_string (Build_info.version ()))
(if debug then "-dbg" else "")
let build_info =
let libs =
List.map (B.Statically_linked_libraries.to_list ()) ~f:(fun lib ->
( B.Statically_linked_library.name lib
, version_to_string (B.Statically_linked_library.version lib) ) )
List.map (Build_info.Statically_linked_libraries.to_list ())
~f:(fun lib ->
( Build_info.Statically_linked_library.name lib
, version_to_string
(Build_info.Statically_linked_library.version lib) ) )
|> List.sort ~compare:[%compare: string * string]
in
let max_length =
@ -34,9 +38,9 @@ let build_info =
max n (String.length name) )
in
String.concat ~sep:"\n"
( "ocaml:"
:: Sys.ocaml_version
( Printf.sprintf "%-*s %s" (max_length + 2) "ocaml:" Sys.ocaml_version
:: "statically linked libraries:"
:: List.map libs ~f:(fun (name, v) ->
Printf.sprintf "- %-*s %s" max_length name v )
@ ["version:"] )
@ [Printf.sprintf "%-*s %b" (max_length + 2) "debug:" debug; "version:"]
)

Loading…
Cancel
Save