Jbuilder: fix rule runtest_indent

This commit is contained in:
Grégoire Henry 2018-01-27 11:21:41 +01:00
parent ff3d8799da
commit 6e629584ff
29 changed files with 69 additions and 30 deletions

View File

@ -25,6 +25,9 @@ build-test:
test: test:
@jbuilder runtest ${DEV} @jbuilder runtest ${DEV}
test-indent:
@jbuilder build @runtest_indent ${DEV}
build-deps: build-deps:
@./scripts/install_build_deps.sh @./scripts/install_build_deps.sh

View File

@ -22,4 +22,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -31,4 +31,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -23,4 +23,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -22,4 +22,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -21,4 +21,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -11,4 +11,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -21,4 +21,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -22,4 +22,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -13,4 +13,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -17,4 +17,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -13,4 +13,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -9,4 +9,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -13,4 +13,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -23,4 +23,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -24,4 +24,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -50,5 +50,17 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) ;; we would like (deps ((glob_files *.ml \ embedded_cmis.ml)))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) ;; 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} ${^}))))

View File

@ -9,6 +9,8 @@
A trick is to provide the `.cmx` through the `(library_flags)` and A trick is to provide the `.cmx` through the `(library_flags)` and
to generate a empty `.ml` to correctly handle the dependencies... *) to generate a empty `.ml` to correctly handle the dependencies... *)
#require "unix"
let prefix = "lib_embedded_protocol_" let prefix = "lib_embedded_protocol_"
let dirname = Filename.basename @@ Sys.getcwd () let dirname = Filename.basename @@ Sys.getcwd ()
@ -29,6 +31,26 @@ let path =
| None -> "src/lib_embedded_protocol_" ^ version | None -> "src/lib_embedded_protocol_" ^ version
| Some _ -> "." | 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 {| let () = Format.kasprintf Jbuild_plugin.V1.send {|
(jbuild_version 1) (jbuild_version 1)
@ -60,10 +82,12 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files src/*.ml) (glob_files src/*.mli))) (deps (@[<v>%a@]))
(action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${<})))) (action (run bash ${libexec:tezos-stdlib:test-ocp-indent.sh} ${^}))))
|} |}
version version version version version version version version version version version version version version version version
path path
version version version version version version
Format.(pp_print_list (fun ppf -> Format.fprintf ppf "%S"))
sources

View File

@ -7,4 +7,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -12,4 +12,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -16,4 +16,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -9,7 +9,7 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (deps ((glob_files *.ml) (glob_files *.mli)))
(action (run bash ${path:test-ocp-indent.sh} ${<})))) (action (run bash ${path:test-ocp-indent.sh} ${^}))))
(install (install
((section libexec) ((section libexec)

View File

@ -17,4 +17,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -13,4 +13,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -10,4 +10,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -47,4 +47,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -69,4 +69,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -44,4 +44,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))

View File

@ -58,4 +58,4 @@
(alias (alias
((name runtest_indent) ((name runtest_indent)
(deps ((glob_files *.ml) (glob_files *.mli))) (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} ${^}))))