Merge node_compiler_main.ml into node_main.ml

This commit is contained in:
Grégoire Henry 2017-10-27 20:22:44 +02:00 committed by Benjamin Canou
parent 3d21245959
commit 9c90e2e514
5 changed files with 15 additions and 32 deletions

View File

@ -231,8 +231,6 @@ NODE_LIB_INTFS := \
node/shell/node_rpc.mli \
NODE_LIB_IMPLS := \
\
compiler/node_compiler_main.ml \
\
node/net/p2p_types.ml \
node/net/p2p_io_scheduler.ml \

View File

@ -1,29 +0,0 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2016. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
(* *)
(**************************************************************************)
let compiler_name = "tezos-protocol-compiler"
let packer_name = "tezos-protocol-packer"
let () =
if Filename.basename Sys.argv.(0) = packer_name then begin
try
Native.main ();
Pervasives.exit 0
with exn ->
Format.eprintf "%a\n%!" Opterrors.report_error exn;
Pervasives.exit 1
end else if Filename.basename Sys.argv.(0) = compiler_name then begin
try
Native.main ();
Pervasives.exit 0
with exn ->
Format.eprintf "%a\n%!" Opterrors.report_error exn;
Pervasives.exit 1
end

View File

@ -66,6 +66,8 @@ let extract dir ?hash (p: Protocol.t) =
(List.map (fun {Protocol.name} -> String.capitalize_ascii name) p.components) ;
Lwt.return_unit
let compiler_name = "tezos-protocol-compiler"
let do_compile hash p =
assert (p.Protocol.expected_env = V1) ;
let units = p.components in
@ -80,7 +82,7 @@ let do_compile hash p =
(List.map (fun {Protocol.name} -> String.capitalize_ascii name) units);
let compiler_command =
(Sys.executable_name,
Array.of_list [Node_compiler_main.compiler_name; plugin_file; source_dir]) in
Array.of_list [compiler_name; plugin_file; source_dir]) in
let fd = Unix.(openfile log_file [O_WRONLY; O_CREAT; O_TRUNC] 0o644) in
let pi =
Lwt_process.exec

View File

@ -77,6 +77,8 @@ end
(* The end of this file is not exported to the protocol... *)
val compiler_name: string
module Node_protocol_environment_sigs : sig
module type V1 = sig

View File

@ -7,6 +7,16 @@
(* *)
(**************************************************************************)
let () =
if Filename.basename Sys.argv.(0) = Updater.compiler_name then begin
try
Native.main ();
Pervasives.exit 0
with exn ->
Format.eprintf "%a\n%!" Opterrors.report_error exn;
Pervasives.exit 1
end
let term =
let open Cmdliner.Term in
ret (const (`Help (`Pager, None)))