Protocol_compiler: Add an option to avoid compiling
This commit is contained in:
parent
077b3cd964
commit
5a60dff917
@ -36,7 +36,7 @@ echo "Computing the protocol hash..."
|
||||
|
||||
cp src/proto_${name}/lib_protocol/src/*.ml src/proto_${name}/lib_protocol/src/*.mli "$alpha_tmpdir"/src/
|
||||
grep -v '"hash"' < src/proto_${name}/lib_protocol/src/TEZOS_PROTOCOL > "$alpha_tmpdir"/src/TEZOS_PROTOCOL
|
||||
long_hash=`./tezos-protocol-compiler $alpha_tmpdir/tmp $alpha_tmpdir/src | cut -d' ' -f2`
|
||||
long_hash=`./tezos-protocol-compiler -hash-only $alpha_tmpdir/tmp $alpha_tmpdir/src`
|
||||
short_hash=$(echo $long_hash | head -c 8)
|
||||
|
||||
if [ -d "src/proto_${version}_${short_hash}" ] ; then
|
||||
|
@ -22,7 +22,7 @@ genesis_tmpdir=`mktemp -d`
|
||||
mkdir $genesis_tmpdir/src
|
||||
cp src/proto_genesis/lib_protocol/src/*.ml src/proto_genesis/lib_protocol/src/*.mli $genesis_tmpdir/src/
|
||||
grep -v '"hash"' < src/proto_genesis/lib_protocol/src/TEZOS_PROTOCOL > $genesis_tmpdir/src/TEZOS_PROTOCOL
|
||||
new_hash_genesis=`./tezos-protocol-compiler $genesis_tmpdir/tmp $genesis_tmpdir/src | cut -d' ' -f2`
|
||||
new_hash_genesis=`./tezos-protocol-compiler -hash-only $genesis_tmpdir/tmp $genesis_tmpdir/src`
|
||||
echo "Genesis's new hash: $new_hash_genesis"
|
||||
if [ "$current_hash_genesis" != "$new_hash_genesis" ]
|
||||
then
|
||||
@ -38,7 +38,7 @@ alpha_tmpdir=`mktemp -d`
|
||||
mkdir $alpha_tmpdir/src
|
||||
cp src/proto_alpha/lib_protocol/src/*.ml src/proto_alpha/lib_protocol/src/*.mli $alpha_tmpdir/src/
|
||||
grep -v '"hash"' < src/proto_alpha/lib_protocol/src/TEZOS_PROTOCOL > $alpha_tmpdir/src/TEZOS_PROTOCOL
|
||||
new_hash_alpha=`./tezos-protocol-compiler $alpha_tmpdir/tmp $alpha_tmpdir/src | cut -d' ' -f2`
|
||||
new_hash_alpha=`./tezos-protocol-compiler -hash-only $alpha_tmpdir/tmp $alpha_tmpdir/src`
|
||||
echo "Alpha's new hash: $new_hash_alpha"
|
||||
if [ "$current_hash_alpha" != "$new_hash_alpha" ]
|
||||
then
|
||||
|
@ -150,10 +150,12 @@ let main { compile_ml ; pack_objects ; link_shared } =
|
||||
and static = ref false
|
||||
and register = ref false
|
||||
and build_dir = ref None
|
||||
and output_dep = ref false in
|
||||
and output_dep = ref false
|
||||
and hash_only = ref false in
|
||||
let args_spec = [
|
||||
"-static", Arg.Set static, " Only build the static library (no .cmxs)";
|
||||
"-register", Arg.Set register, " Generete the `Registerer` module";
|
||||
"-hash-only", Arg.Set hash_only, " Don't compile" ;
|
||||
"-static", Arg.Set static, " Only build the static library (no .cmxs)" ;
|
||||
"-register", Arg.Set register, " Generete the `Registerer` module" ;
|
||||
"-bin-annot", Arg.Set Clflags.binary_annotations, " (see ocamlopt)" ;
|
||||
"-g", Arg.Set Clflags.debug, " (see ocamlopt)" ;
|
||||
"-output-dep", Arg.Set output_dep, " ..." ;
|
||||
@ -182,6 +184,10 @@ let main { compile_ml ; pack_objects ; link_shared } =
|
||||
| Error err ->
|
||||
Format.kasprintf Pervasives.failwith
|
||||
"Failed to read TEZOS_PROTOCOL: %a" pp_print_error err in
|
||||
if !hash_only then begin
|
||||
Format.printf "%a@." Protocol_hash.pp hash ;
|
||||
exit 0
|
||||
end ;
|
||||
Lwt_main.run (Lwt_utils_unix.create_dir ~perm:0o755 build_dir) ;
|
||||
Lwt_main.run (Lwt_utils_unix.create_dir ~perm:0o755 (Filename.dirname output)) ;
|
||||
(* Generate the 'functor' *)
|
||||
|
Loading…
Reference in New Issue
Block a user