[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 ) ; true ) ;
!d !d
module B = Build_info.V1 module Build_info = Build_info.V1
let version_to_string v = 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 = 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 build_info =
let libs = let libs =
List.map (B.Statically_linked_libraries.to_list ()) ~f:(fun lib -> List.map (Build_info.Statically_linked_libraries.to_list ())
( B.Statically_linked_library.name lib ~f:(fun lib ->
, version_to_string (B.Statically_linked_library.version lib) ) ) ( Build_info.Statically_linked_library.name lib
, version_to_string
(Build_info.Statically_linked_library.version lib) ) )
|> List.sort ~compare:[%compare: string * string] |> List.sort ~compare:[%compare: string * string]
in in
let max_length = let max_length =
@ -34,9 +38,9 @@ let build_info =
max n (String.length name) ) max n (String.length name) )
in in
String.concat ~sep:"\n" String.concat ~sep:"\n"
( "ocaml:" ( Printf.sprintf "%-*s %s" (max_length + 2) "ocaml:" Sys.ocaml_version
:: Sys.ocaml_version
:: "statically linked libraries:" :: "statically linked libraries:"
:: List.map libs ~f:(fun (name, v) -> :: List.map libs ~f:(fun (name, v) ->
Printf.sprintf "- %-*s %s" max_length name v ) Printf.sprintf "- %-*s %s" max_length name v )
@ ["version:"] ) @ [Printf.sprintf "%-*s %b" (max_length + 2) "debug:" debug; "version:"]
)

Loading…
Cancel
Save