From 05da5a73b85988865ff7bde3d28a93c5d191c59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Sat, 28 Oct 2017 23:14:00 +0200 Subject: [PATCH] Jbuilder: Wrap the `Tezos_protocol_compiler` --- src/client/client_protocols.ml | 2 +- src/compiler/embedded_cmis.mli | 2 +- src/compiler/jbuild | 3 +-- src/compiler/native.ml | 4 ++-- src/compiler_main.ml | 2 +- src/node/shell/state.ml | 4 ++-- src/node/updater/updater.ml | 8 ++++---- src/node_main.ml | 2 +- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/client/client_protocols.ml b/src/client/client_protocols.ml index 0bbc41418..7244b3879 100644 --- a/src/client/client_protocols.ml +++ b/src/client/client_protocols.ml @@ -39,7 +39,7 @@ let commands () = (fun () dirname cctxt -> Lwt.catch (fun () -> - let _hash, proto = Native.read_dir dirname in + let _hash, proto = Tezos_protocol_compiler.Native.read_dir dirname in Client_node_rpcs.inject_protocol cctxt.rpc_config proto >>= function | Ok hash -> cctxt.message "Injected protocol %a successfully" Protocol_hash.pp_short hash >>= fun () -> diff --git a/src/compiler/embedded_cmis.mli b/src/compiler/embedded_cmis.mli index 45088e5dc..3d6c8780d 100644 --- a/src/compiler/embedded_cmis.mli +++ b/src/compiler/embedded_cmis.mli @@ -9,4 +9,4 @@ val camlinternalFormatBasics_cmi: string val tezos_protocol_environment_sigs_v1_cmi: string -val registerer_cmi: string +val tezos_protocol_compiler__Registerer_cmi: string diff --git a/src/compiler/jbuild b/src/compiler/jbuild index 1870124e8..5e451063f 100644 --- a/src/compiler/jbuild +++ b/src/compiler/jbuild @@ -5,7 +5,7 @@ (action (run ${bin:ocp-ocamlres} -format ocaml -o ${@} ${lib:stdlib:camlinternalFormatBasics.cmi} - ${path:registerer.cmi} + ${path:tezos_protocol_compiler__Registerer.cmi} ${path:../environment/tezos_protocol_environment_sigs_v1.cmi})))) (library @@ -19,7 +19,6 @@ ocplib-endian ocplib-ocamlres unix)) - (wrapped false) (flags (:standard -w +27-30-40@8 -opaque -open Error_monad diff --git a/src/compiler/native.ml b/src/compiler/native.ml index 5ccc545f8..e260ffa7c 100644 --- a/src/compiler/native.ml +++ b/src/compiler/native.ml @@ -115,7 +115,7 @@ let tezos_protocol_env = let register_env = let open Embedded_cmis in [ - "registerer", registerer_cmi ; + "tezos_protocol_compiler__Registerer", tezos_protocol_compiler__Registerer_cmi ; ] @@ -319,7 +319,7 @@ let main () = create_file register_file (Printf.sprintf "module Name = struct let name = %S end\n\ - \ let () = Registerer.register Name.name (module %s.Make)" + \ let () = Tezos_protocol_compiler__Registerer.register Name.name (module %s.Make)" (Protocol_hash.to_b58check hash) functor_unit) ; let register_object = compile_ml ~for_pack register_file in diff --git a/src/compiler_main.ml b/src/compiler_main.ml index de6366ed5..f8fdd2ce5 100644 --- a/src/compiler_main.ml +++ b/src/compiler_main.ml @@ -9,7 +9,7 @@ let () = try - Native.main (); + Tezos_protocol_compiler.Native.main (); Pervasives.exit 0 with exn -> Format.eprintf "%a\n%!" Opterrors.report_error exn; diff --git a/src/node/shell/state.ml b/src/node/shell/state.ml index e7be16f41..e26c857f3 100644 --- a/src/node/shell/state.ml +++ b/src/node/shell/state.ml @@ -586,7 +586,7 @@ module Registred_protocol = struct end let build_v1 hash = - let (module F) = Registerer.get_exn hash in + let (module F) = Tezos_protocol_compiler.Registerer.get_exn hash in let module Name = struct let name = Protocol_hash.to_b58check hash end in @@ -605,7 +605,7 @@ module Registred_protocol = struct VersionTable.create 20 let mem hash = - VersionTable.mem versions hash || Registerer.mem hash + VersionTable.mem versions hash || Tezos_protocol_compiler.Registerer.mem hash let get_exn hash = try VersionTable.find versions hash diff --git a/src/node/updater/updater.ml b/src/node/updater/updater.ml index 446a86481..68ec1f27d 100644 --- a/src/node/updater/updater.ml +++ b/src/node/updater/updater.ml @@ -60,7 +60,7 @@ let create_files dir units = let extract dir ?hash (p: Protocol.t) = create_files dir p.components >>= fun _files -> - Native.Meta.to_file dir + Tezos_protocol_compiler.Native.Meta.to_file dir ?hash ~env_version:p.expected_env (List.map (fun {Protocol.name} -> String.capitalize_ascii name) p.components) ; @@ -78,7 +78,7 @@ let do_compile hash p = Format.asprintf "protocol_%a.cmxs" Protocol_hash.pp hash in create_files source_dir units >>= fun _files -> - Native.Meta.to_file source_dir ~hash + Tezos_protocol_compiler.Native.Meta.to_file source_dir ~hash (List.map (fun {Protocol.name} -> String.capitalize_ascii name) units); let compiler_command = (Sys.executable_name, @@ -103,11 +103,11 @@ let do_compile hash p = Lwt.return false let compile hash p = - if Registerer.mem hash then + if Tezos_protocol_compiler.Registerer.mem hash then Lwt.return true else begin do_compile hash p >>= fun success -> - let loaded = Registerer.mem hash in + let loaded = Tezos_protocol_compiler.Registerer.mem hash in if success && not loaded then log_error "Internal error while compiling %a" Protocol_hash.pp hash; Lwt.return loaded diff --git a/src/node_main.ml b/src/node_main.ml index 7e24a8472..c154070c6 100644 --- a/src/node_main.ml +++ b/src/node_main.ml @@ -10,7 +10,7 @@ let () = if Filename.basename Sys.argv.(0) = Updater.compiler_name then begin try - Native.main (); + Tezos_protocol_compiler.Native.main (); Pervasives.exit 0 with exn -> Format.eprintf "%a\n%!" Opterrors.report_error exn;