ligo/src/lib_protocol_compiler/jbuild_protocol_template

62 lines
1.7 KiB
Plaintext
Raw Normal View History

(* -*- tuareg -*- *)
let prefix = "proto_"
let dirname = Filename.basename @@ Filename.dirname @@ Sys.getcwd ()
let predefined_version = None (* to be substituted in opam packages *)
let lib_version =
match predefined_version with
| Some version -> version
| None ->
let x = String.length prefix in
let n = String.length dirname in
if not (n >= x && String.sub dirname 0 x = prefix) then
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"
| Some _ -> "."
2018-01-27 11:21:41 +01:00
let sources =
2018-07-25 21:06:02 +02:00
Format.kasprintf
Jbuild_plugin.V1.run_and_read_lines
"find src -name \\*.ml -or -name \\*.mli"
2018-01-27 11:21:41 +01:00
let () = Format.kasprintf Jbuild_plugin.V1.send {|
2018-01-30 16:30:22 +01:00
(rule
2018-07-25 21:06:02 +02:00
(targets functor.ml)
(deps (glob_files src/*.ml{,i})
(:src_dir src/TEZOS_PROTOCOL))
(action (with-stdout-to %%{targets}
(chdir %%{workspace_root}
(run %%{bin:tezos-protocol-compiler.tezos-protocol-packer} %%{src_dir})))))
(library
2018-07-25 21:06:02 +02:00
(name tezos_protocol_%s)
(public_name tezos-protocol-%s)
(libraries tezos-protocol-environment-sigs)
(flags -w "+a-4-6-7-9-29-40..42-44-45-48"
-warn-error "-a+8"
-safe-string -nopervasives)
(modules Functor))
2018-01-30 16:30:22 +01:00
(alias
2018-07-25 21:06:02 +02:00
(name runtest_sandbox)
(deps .tezos_protocol_%s.objs/tezos_protocol_%s.cmx))
(alias
2018-07-25 21:06:02 +02:00
(name runtest_indent)
(deps @[<v>%a@])
(action (run bash %%{libexec:tezos-stdlib:test-ocp-indent.sh} %%{deps})))
|}
2018-07-25 21:06:02 +02:00
lib_version version lib_version lib_version
2018-01-27 11:21:41 +01:00
Format.(pp_print_list (fun ppf -> Format.fprintf ppf "%S"))
sources