From 50151c55a167f5e2f53fc114ae1a17f89726e227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Thu, 19 Jul 2018 01:53:28 +0200 Subject: [PATCH] Compiler: allow for `_` in protocol directory name. --- .../jbuild_embedded_protocol_template | 9 ++++++--- src/lib_protocol_compiler/jbuild_protocol_template | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib_protocol_compiler/jbuild_embedded_protocol_template b/src/lib_protocol_compiler/jbuild_embedded_protocol_template index ccf2b449d..2f91bc56f 100644 --- a/src/lib_protocol_compiler/jbuild_embedded_protocol_template +++ b/src/lib_protocol_compiler/jbuild_embedded_protocol_template @@ -5,7 +5,7 @@ let dirname = Filename.basename @@ Filename.dirname @@ Filename.dirname @@ Sys.g let predefined_version = None (* to be substituted in opam packages *) -let version = +let lib_version = match predefined_version with | Some version -> version | None -> @@ -15,6 +15,8 @@ let version = failwith "unexpected directory name" ; String.sub dirname x (n - x) +let version = String.concat "-" (String.split_on_char '_' lib_version) + let () = Format.kasprintf Jbuild_plugin.V1.send {| (jbuild_version 1) @@ -64,5 +66,6 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {| -warn-error -a+8)) (modules (Registerer)))) |} - version version version version version version version version - version version version version + version lib_version lib_version lib_version + version lib_version version lib_version + lib_version lib_version version lib_version diff --git a/src/lib_protocol_compiler/jbuild_protocol_template b/src/lib_protocol_compiler/jbuild_protocol_template index c1dbfa617..ecb9d1b10 100644 --- a/src/lib_protocol_compiler/jbuild_protocol_template +++ b/src/lib_protocol_compiler/jbuild_protocol_template @@ -16,7 +16,7 @@ let dirname = Filename.basename @@ Filename.dirname @@ Sys.getcwd () let predefined_version = None (* to be substituted in opam packages *) -let version = +let lib_version = match predefined_version with | Some version -> version | None -> @@ -26,6 +26,8 @@ let version = failwith "unexpected directory name" ; String.sub dirname x (n - x) +let version = String.concat "-" (String.split_on_char '_' lib_version) + let path = match predefined_version with | None -> "src/proto_" ^ version ^ "/lib_protocol" @@ -80,6 +82,6 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {| (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) |} - version version version + lib_version version lib_version Format.(pp_print_list (fun ppf -> Format.fprintf ppf "%S")) sources