From 924d74c7887da1a81c246fbe1eb397ea99a814c1 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 24 Jul 2024 17:04:13 +0200 Subject: [PATCH] proto-compiler: add a dump-only option --- src/lib_protocol_compiler/compiler.ml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib_protocol_compiler/compiler.ml b/src/lib_protocol_compiler/compiler.ml index c2864c2f0a1a..5071968f6505 100644 --- a/src/lib_protocol_compiler/compiler.ml +++ b/src/lib_protocol_compiler/compiler.ml @@ -149,6 +149,7 @@ let main {compile_ml; pack_objects; link_shared} version = and output_file = ref None and output_dep = ref false and hash_only = ref false + and dump_only = ref false and check_protocol_hash = ref true in let args_spec = [ @@ -156,6 +157,9 @@ let main {compile_ml; pack_objects; link_shared} version = ( "-hash-only", Arg.Set hash_only, " Only display the hash of the protocol and don't compile" ); + ( "-dump-only", + Arg.Set dump_only, + " Only dump bytes of the protocol and don't compile" ); ( "-no-hash-check", Arg.Clear check_protocol_hash, " Don't check that TEZOS_PROTOCOL declares the expected protocol hash \ @@ -202,6 +206,9 @@ let main {compile_ml; pack_objects; link_shared} version = Format.eprintf "Failed to read TEZOS_PROTOCOL: %a" pp_print_trace err ; exit 2 in + if !dump_only then ( + Format.printf "%s" (Bytes.to_string (Protocol.to_bytes protocol)) ; + exit 0) ; let computed_hash = Protocol.hash protocol in if !hash_only then ( Format.printf "%a@." Protocol_hash.pp computed_hash ; -- GitLab