From 9c90e2e514313eebf86badcfdc57f4785401a579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 27 Oct 2017 20:22:44 +0200 Subject: [PATCH] Merge `node_compiler_main.ml` into `node_main.ml` --- src/Makefile.files | 2 -- src/compiler/node_compiler_main.ml | 29 ----------------------------- src/node/updater/updater.ml | 4 +++- src/node/updater/updater.mli | 2 ++ src/node_main.ml | 10 ++++++++++ 5 files changed, 15 insertions(+), 32 deletions(-) delete mode 100644 src/compiler/node_compiler_main.ml diff --git a/src/Makefile.files b/src/Makefile.files index 970b8e3ff..641af2fb6 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -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 \ diff --git a/src/compiler/node_compiler_main.ml b/src/compiler/node_compiler_main.ml deleted file mode 100644 index 15e41eab2..000000000 --- a/src/compiler/node_compiler_main.ml +++ /dev/null @@ -1,29 +0,0 @@ -(**************************************************************************) -(* *) -(* Copyright (c) 2014 - 2016. *) -(* Dynamic Ledger Solutions, Inc. *) -(* *) -(* 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 - diff --git a/src/node/updater/updater.ml b/src/node/updater/updater.ml index 39e056ef7..446a86481 100644 --- a/src/node/updater/updater.ml +++ b/src/node/updater/updater.ml @@ -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 diff --git a/src/node/updater/updater.mli b/src/node/updater/updater.mli index ec1a2249d..0dcd13fd8 100644 --- a/src/node/updater/updater.mli +++ b/src/node/updater/updater.mli @@ -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 diff --git a/src/node_main.ml b/src/node_main.ml index 81cc0e395..7e24a8472 100644 --- a/src/node_main.ml +++ b/src/node_main.ml @@ -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)))