From 6e629584ff9e8f7fac338e37432dbb263343734f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Sat, 27 Jan 2018 11:21:41 +0100 Subject: [PATCH] Jbuilder: fix rule `runtest_indent` --- Makefile | 3 ++ src/bin_client/jbuild | 2 +- src/bin_node/jbuild | 2 +- src/lib_base/jbuild | 2 +- src/lib_client_base/jbuild | 2 +- src/lib_crypto/jbuild | 2 +- src/lib_data_encoding/jbuild | 2 +- src/lib_embedded_client_alpha/jbuild | 2 +- src/lib_embedded_client_genesis/jbuild | 2 +- src/lib_error_monad/jbuild | 2 +- src/lib_micheline/jbuild | 2 +- src/lib_node_p2p/jbuild | 2 +- src/lib_node_p2p_base/jbuild | 2 +- src/lib_node_services/jbuild | 2 +- src/lib_node_shell/jbuild | 2 +- src/lib_node_updater/jbuild | 2 +- src/lib_protocol_compiler/jbuild | 16 +++++++++-- .../jbuild_protocol_template | 28 +++++++++++++++++-- .../sigs_packer/jbuild | 2 +- src/lib_rpc_base/jbuild | 2 +- src/lib_rpc_http/jbuild | 2 +- src/lib_stdlib/jbuild | 2 +- src/lib_stdlib_lwt/jbuild | 2 +- src/lib_storage/jbuild | 2 +- test/lib/jbuild | 2 +- test/p2p/jbuild | 2 +- test/proto_alpha/jbuild | 2 +- test/shell/jbuild | 2 +- test/utils/jbuild | 2 +- 29 files changed, 69 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 38d562e32..d7447efb7 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ build-test: test: @jbuilder runtest ${DEV} +test-indent: + @jbuilder build @runtest_indent ${DEV} + build-deps: @./scripts/install_build_deps.sh diff --git a/src/bin_client/jbuild b/src/bin_client/jbuild index 9b266a2ca..f4222063d 100644 --- a/src/bin_client/jbuild +++ b/src/bin_client/jbuild @@ -22,4 +22,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/bin_node/jbuild b/src/bin_node/jbuild index d4d47142b..fd47d07fe 100644 --- a/src/bin_node/jbuild +++ b/src/bin_node/jbuild @@ -31,4 +31,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_base/jbuild b/src/lib_base/jbuild index 8e24c3db9..288c39b08 100644 --- a/src/lib_base/jbuild +++ b/src/lib_base/jbuild @@ -23,4 +23,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_client_base/jbuild b/src/lib_client_base/jbuild index 7080394fd..b8daae869 100644 --- a/src/lib_client_base/jbuild +++ b/src/lib_client_base/jbuild @@ -22,4 +22,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_crypto/jbuild b/src/lib_crypto/jbuild index 68d343d9a..e5020e221 100644 --- a/src/lib_crypto/jbuild +++ b/src/lib_crypto/jbuild @@ -21,4 +21,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_data_encoding/jbuild b/src/lib_data_encoding/jbuild index b1b854d12..1228096cb 100644 --- a/src/lib_data_encoding/jbuild +++ b/src/lib_data_encoding/jbuild @@ -11,4 +11,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_embedded_client_alpha/jbuild b/src/lib_embedded_client_alpha/jbuild index 4826707a8..29ba8ba36 100644 --- a/src/lib_embedded_client_alpha/jbuild +++ b/src/lib_embedded_client_alpha/jbuild @@ -21,4 +21,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_embedded_client_genesis/jbuild b/src/lib_embedded_client_genesis/jbuild index 17d1d5450..8ba564eac 100644 --- a/src/lib_embedded_client_genesis/jbuild +++ b/src/lib_embedded_client_genesis/jbuild @@ -22,4 +22,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_error_monad/jbuild b/src/lib_error_monad/jbuild index 4be7d1ba1..ad1be66c9 100644 --- a/src/lib_error_monad/jbuild +++ b/src/lib_error_monad/jbuild @@ -13,4 +13,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_micheline/jbuild b/src/lib_micheline/jbuild index f1b7d16f7..3b00b3da7 100644 --- a/src/lib_micheline/jbuild +++ b/src/lib_micheline/jbuild @@ -17,4 +17,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_node_p2p/jbuild b/src/lib_node_p2p/jbuild index 285b94204..a76ffe6e0 100644 --- a/src/lib_node_p2p/jbuild +++ b/src/lib_node_p2p/jbuild @@ -13,4 +13,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_node_p2p_base/jbuild b/src/lib_node_p2p_base/jbuild index 9010347ac..3f0670abb 100644 --- a/src/lib_node_p2p_base/jbuild +++ b/src/lib_node_p2p_base/jbuild @@ -9,4 +9,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_node_services/jbuild b/src/lib_node_services/jbuild index 972d9753d..26f9448a1 100644 --- a/src/lib_node_services/jbuild +++ b/src/lib_node_services/jbuild @@ -13,4 +13,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_node_shell/jbuild b/src/lib_node_shell/jbuild index bd262a06c..277b430d7 100644 --- a/src/lib_node_shell/jbuild +++ b/src/lib_node_shell/jbuild @@ -23,4 +23,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_node_updater/jbuild b/src/lib_node_updater/jbuild index c80e76a3e..8fc173087 100644 --- a/src/lib_node_updater/jbuild +++ b/src/lib_node_updater/jbuild @@ -24,4 +24,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_protocol_compiler/jbuild b/src/lib_protocol_compiler/jbuild index fca4b114f..90628dd36 100644 --- a/src/lib_protocol_compiler/jbuild +++ b/src/lib_protocol_compiler/jbuild @@ -50,5 +50,17 @@ (alias ((name runtest_indent) - (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + ;; we would like (deps ((glob_files *.ml \ embedded_cmis.ml))) + ;; meanwhile, we hardcode the module list + (deps ("embedded_cmis.mli" + "main_embedded_packer.ml" + "main_embedded_packer.mli" + "main.ml" + "native.ml" + "native.mli" + "packer.ml" + "packer.mli" + "registerer.ml" + "registerer.mli" + )) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_protocol_compiler/jbuild_protocol_template b/src/lib_protocol_compiler/jbuild_protocol_template index af0a79cf8..12df7c31d 100644 --- a/src/lib_protocol_compiler/jbuild_protocol_template +++ b/src/lib_protocol_compiler/jbuild_protocol_template @@ -9,6 +9,8 @@ A trick is to provide the `.cmx` through the `(library_flags)` and to generate a empty `.ml` to correctly handle the dependencies... *) +#require "unix" + let prefix = "lib_embedded_protocol_" let dirname = Filename.basename @@ Sys.getcwd () @@ -29,6 +31,26 @@ let path = | None -> "src/lib_embedded_protocol_" ^ version | Some _ -> "." +let sources = + let d = Unix.opendir "src" in + let rec loop acc = + match Unix.readdir d with + | exception End_of_file -> + Unix.closedir d ; + acc + | file -> + let acc = + if Filename.check_suffix file ".mli" + || Filename.check_suffix file ".ml" then + ("src/" ^ file) :: acc + else + acc + in + loop acc in + loop [] + +module M = Unix + let () = Format.kasprintf Jbuild_plugin.V1.send {| (jbuild_version 1) @@ -60,10 +82,12 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {| (alias ((name runtest_indent) - (deps ((glob_files src/*.ml) (glob_files src/*.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (deps (@[%a@])) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) |} version version version version version version version version path version version version + Format.(pp_print_list (fun ppf -> Format.fprintf ppf "%S")) + sources diff --git a/src/lib_protocol_environment_sigs/sigs_packer/jbuild b/src/lib_protocol_environment_sigs/sigs_packer/jbuild index 4ae1e3367..d68d257c4 100644 --- a/src/lib_protocol_environment_sigs/sigs_packer/jbuild +++ b/src/lib_protocol_environment_sigs/sigs_packer/jbuild @@ -7,4 +7,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_rpc_base/jbuild b/src/lib_rpc_base/jbuild index a764832c0..0ec17c9f4 100644 --- a/src/lib_rpc_base/jbuild +++ b/src/lib_rpc_base/jbuild @@ -12,4 +12,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_rpc_http/jbuild b/src/lib_rpc_http/jbuild index da175c374..0fe821d41 100644 --- a/src/lib_rpc_http/jbuild +++ b/src/lib_rpc_http/jbuild @@ -16,4 +16,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_stdlib/jbuild b/src/lib_stdlib/jbuild index a306b19df..d71b01d96 100644 --- a/src/lib_stdlib/jbuild +++ b/src/lib_stdlib/jbuild @@ -9,7 +9,7 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${path:test-ocp-indent.sh} ${<})))) + (action (run bash ${path:test-ocp-indent.sh} ${^})))) (install ((section libexec) diff --git a/src/lib_stdlib_lwt/jbuild b/src/lib_stdlib_lwt/jbuild index 7c175d402..3cf892372 100644 --- a/src/lib_stdlib_lwt/jbuild +++ b/src/lib_stdlib_lwt/jbuild @@ -17,4 +17,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/src/lib_storage/jbuild b/src/lib_storage/jbuild index a9d73a7e3..42b805969 100644 --- a/src/lib_storage/jbuild +++ b/src/lib_storage/jbuild @@ -13,4 +13,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/lib/jbuild b/test/lib/jbuild index 01be577d5..b8f38ab51 100644 --- a/test/lib/jbuild +++ b/test/lib/jbuild @@ -10,4 +10,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/p2p/jbuild b/test/p2p/jbuild index e18571328..f410f6892 100644 --- a/test/p2p/jbuild +++ b/test/p2p/jbuild @@ -47,4 +47,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/proto_alpha/jbuild b/test/proto_alpha/jbuild index f3c94b12f..cd911d4af 100644 --- a/test/proto_alpha/jbuild +++ b/test/proto_alpha/jbuild @@ -69,4 +69,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/shell/jbuild b/test/shell/jbuild index 534bf5c3d..0542f65c5 100644 --- a/test/shell/jbuild +++ b/test/shell/jbuild @@ -44,4 +44,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^})))) diff --git a/test/utils/jbuild b/test/utils/jbuild index 858e6623d..4c062baea 100644 --- a/test/utils/jbuild +++ b/test/utils/jbuild @@ -58,4 +58,4 @@ (alias ((name runtest_indent) (deps ((glob_files *.ml) (glob_files *.mli))) - (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) + (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))