Jbuilder: Wrap the Tezos_protocol_compiler
This commit is contained in:
parent
0a7f9a39a9
commit
05da5a73b8
@ -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 () ->
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user