Fix protocol injection

- Rename Tezos_protocol_compiler_native__Registerer
- Pass module without extension to the compiler
This commit is contained in:
Pietro 2018-02-13 12:12:01 +01:00
parent f38ee469e9
commit 4d9f440aae
2 changed files with 3 additions and 3 deletions

View File

@ -226,7 +226,7 @@ let main { compile_ml ; pack_objects ; link_shared } =
create_file register_file create_file register_file
(Printf.sprintf (Printf.sprintf
"module Name = struct let name = %S end\n\ "module Name = struct let name = %S end\n\
\ let () = Tezos_protocol_compiler_native__Registerer.register Name.name (module %s.Make)" \ let () = Tezos_protocol_registerer__Registerer.register Name.name (module %s.Make)"
(Protocol_hash.to_b58check hash) (Protocol_hash.to_b58check hash)
functor_unit) ; functor_unit) ;
let register_object = compile_ml ~for_pack register_file in let register_object = compile_ml ~for_pack register_file in

View File

@ -58,7 +58,7 @@ module Raw = struct
let source_dir = datadir // Protocol_hash.to_short_b58check hash // "src" in let source_dir = datadir // Protocol_hash.to_short_b58check hash // "src" in
let log_file = datadir // Protocol_hash.to_short_b58check hash // "LOG" in let log_file = datadir // Protocol_hash.to_short_b58check hash // "LOG" in
let plugin_file = datadir // Protocol_hash.to_short_b58check hash // let plugin_file = datadir // Protocol_hash.to_short_b58check hash //
Format.asprintf "protocol_%a.cmxs" Protocol_hash.pp hash Format.asprintf "protocol_%a" Protocol_hash.pp hash
in in
begin begin
Lwt_utils_unix.Protocol.write_dir source_dir ~hash p >>=? fun () -> Lwt_utils_unix.Protocol.write_dir source_dir ~hash p >>=? fun () ->
@ -80,7 +80,7 @@ module Raw = struct
log_error "COMPILATION ERROR (%s)" log_file; log_error "COMPILATION ERROR (%s)" log_file;
Lwt.return false Lwt.return false
| Ok (Unix.WEXITED _) -> | Ok (Unix.WEXITED _) ->
try Dynlink.loadfile_private plugin_file; Lwt.return true try Dynlink.loadfile_private (plugin_file ^ ".cmxs"); Lwt.return true
with Dynlink.Error err -> with Dynlink.Error err ->
log_error "Can't load plugin: %s (%s)" log_error "Can't load plugin: %s (%s)"
(Dynlink.error_message err) plugin_file; (Dynlink.error_message err) plugin_file;