Skip to content

Commit

Permalink
Enable formatting of dune files
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Rebours <[email protected]>
  • Loading branch information
NathanReb committed Jan 28, 2021
1 parent 251c4bd commit 1af0b48
Show file tree
Hide file tree
Showing 27 changed files with 175 additions and 136 deletions.
31 changes: 17 additions & 14 deletions ast/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@
;; (per_module <action> <module_list>)

(library
(name ppxlib_ast)
(name ppxlib_ast)
(public_name ppxlib.ast)
(libraries
ocaml-compiler-libs.shadow
ocaml-compiler-libs.common
compiler-libs.common
ocaml-migrate-parsetree
stdlib-shims)
(flags (:standard -open Ocaml_shadow -safe-string) -w -9-27-32)
(libraries ocaml-compiler-libs.shadow ocaml-compiler-libs.common
compiler-libs.common ocaml-migrate-parsetree stdlib-shims)
(flags
(:standard -open Ocaml_shadow -safe-string)
-w
-9-27-32)
(preprocess
(per_module
((action (run %{exe:pp/pp.exe} %{ocaml_version} %{input-file}))
versions
location_error)))
(lint (pps ppxlib_traverse -deriving-keep-w32=impl)))
((action
(run %{exe:pp/pp.exe} %{ocaml_version} %{input-file}))
versions
location_error)))
(lint
(pps ppxlib_traverse -deriving-keep-w32=impl)))

;; This is to make the code compatible with different versions of
;; OCaml

(rule
(targets location_helper.ml clflags_helper.ml misc_helper.ml)
(deps gen-compiler_specifics)
(action (run %{ocaml} %{deps} %{ocaml_version} %{targets})))
(deps gen-compiler_specifics)
(action
(run %{ocaml} %{deps} %{ocaml_version} %{targets})))

(cinaps
(files *.ml *.mli)
Expand Down
3 changes: 2 additions & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

(alias
(name runtest)
(deps (alias_rec lint)))
(deps
(alias_rec lint)))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name ppxlib)
(using cinaps 1.0)
(allow_approximate_merlin)
(formatting disabled)
(formatting (enabled_for dune))
(cram enable)
(generate_opam_files true)

Expand Down
3 changes: 2 additions & 1 deletion examples/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(alias
(name runtest)
(deps (alias_rec all)))
(deps
(alias_rec all)))
10 changes: 4 additions & 6 deletions metaquot/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
(library
(name ppxlib_metaquot)
(name ppxlib_metaquot)
(public_name ppxlib.metaquot)
(kind ppx_rewriter)
(flags (:standard -safe-string))
(libraries
ppxlib
ppxlib_traverse_builtins
ppxlib_metaquot_lifters))
(flags
(:standard -safe-string))
(libraries ppxlib ppxlib_traverse_builtins ppxlib_metaquot_lifters))
7 changes: 4 additions & 3 deletions metaquot_lifters/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(library
(name ppxlib_metaquot_lifters)
(name ppxlib_metaquot_lifters)
(public_name ppxlib.metaquot_lifters)
(flags (:standard -safe-string))
(libraries ppxlib ppxlib_traverse_builtins))
(flags
(:standard -safe-string))
(libraries ppxlib ppxlib_traverse_builtins))
3 changes: 2 additions & 1 deletion print-diff/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(library
(name ppxlib_print_diff)
(public_name ppxlib.print_diff)
(flags (:standard -safe-string)))
(flags
(:standard -safe-string)))
9 changes: 5 additions & 4 deletions runner/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
;; be linked after all other libraries and units.

(library
(name ppxlib_runner)
(public_name ppxlib.runner)
(flags (:standard -safe-string))
(libraries ppxlib)
(name ppxlib_runner)
(public_name ppxlib.runner)
(flags
(:standard -safe-string))
(libraries ppxlib)
(library_flags -linkall))
4 changes: 3 additions & 1 deletion runner_as_ppx/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
;; This library just contain the entry point for ppx drivers. It must
;; be linked after all other libraries and units.

(library
(name ppxlib_runner_as_ppx)
(public_name ppxlib.runner_as_ppx)
(library_flags -linkall)
(flags (:standard -safe-string))
(flags
(:standard -safe-string))
(libraries ppxlib))
37 changes: 19 additions & 18 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
(library
(name ppxlib)
(public_name ppxlib)
(libraries
ocaml-compiler-libs.common
compiler-libs.common
ocaml-compiler-libs.shadow
ppxlib_ast
ppxlib_print_diff
ppx_derivers
ppxlib_traverse_builtins
stdppx)
(flags (:standard -open Ocaml_shadow -safe-string))
(libraries ocaml-compiler-libs.common compiler-libs.common
ocaml-compiler-libs.shadow ppxlib_ast ppxlib_print_diff ppx_derivers
ppxlib_traverse_builtins stdppx)
(flags
(:standard -open Ocaml_shadow -safe-string))
(ppx.driver
(main Ppxlib.Driver.standalone)
(flags (-corrected-suffix %{corrected-suffix} -diff-cmd - -dump-ast))
(lint_flags (-corrected-suffix %{corrected-suffix} -diff-cmd - -null ))))
(main Ppxlib.Driver.standalone)
(flags
(-corrected-suffix %{corrected-suffix} -diff-cmd - -dump-ast))
(lint_flags
(-corrected-suffix %{corrected-suffix} -diff-cmd - -null))))

(cinaps
(files *.ml *.mli)
(libraries ppxlib_cinaps_helpers))

(rule
(targets ast_pattern_generated.ml)
(deps gen/gen_ast_pattern.exe)
(action (run ./gen/gen_ast_pattern.exe %{lib:ppxlib.ast:ast.ml})))
(deps gen/gen_ast_pattern.exe)
(action
(run ./gen/gen_ast_pattern.exe %{lib:ppxlib.ast:ast.ml})))

(rule
(targets ast_builder_generated.ml)
(deps gen/gen_ast_builder.exe)
(action (run ./gen/gen_ast_builder.exe %{lib:ppxlib.ast:ast.ml})))
(action
(run ./gen/gen_ast_builder.exe %{lib:ppxlib.ast:ast.ml})))

;; This is to make the code compatible with different versions of
;; OCaml

(rule
(targets compiler_specifics.ml)
(deps gen-compiler_specifics)
(action (run %{ocaml} %{deps} %{ocaml_version} %{targets})))
(deps gen-compiler_specifics)
(action
(run %{ocaml} %{deps} %{ocaml_version} %{targets})))
11 changes: 4 additions & 7 deletions src/gen/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
(executables
(names gen_ast_pattern gen_ast_builder)
(flags (:standard -safe-string))
(libraries
ppxlib_ast
compiler-libs.common
compiler-libs.bytecomp
ppxlib_traverse_builtins
stdppx))
(flags
(:standard -safe-string))
(libraries ppxlib_ast compiler-libs.common compiler-libs.bytecomp
ppxlib_traverse_builtins stdppx))
8 changes: 3 additions & 5 deletions stdppx/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(library
(name stdppx)
(public_name ppxlib.stdppx)
(libraries
ocaml-compiler-libs.shadow
sexplib0
stdlib-shims)
(flags (:standard -open Ocaml_shadow -safe-string)))
(libraries ocaml-compiler-libs.shadow sexplib0 stdlib-shims)
(flags
(:standard -open Ocaml_shadow -safe-string)))
13 changes: 8 additions & 5 deletions test/base/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.09.0"))
(enabled_if
(>= %{ocaml_version} "4.09.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
13 changes: 8 additions & 5 deletions test/code_path/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.08.0"))
(enabled_if
(>= %{ocaml_version} "4.08.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
13 changes: 8 additions & 5 deletions test/deriving/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.10.0"))
(enabled_if
(>= %{ocaml_version} "4.10.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
11 changes: 5 additions & 6 deletions test/deriving/inline/example/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
(library
(name ppx_deriving_example)
(preprocess (pps ppx_foo_deriver))
)
(name ppx_deriving_example)
(preprocess
(pps ppx_foo_deriver)))

(alias
(name runtest)
(deps ppx_deriving_example.cma)
)
(name runtest)
(deps ppx_deriving_example.cma))
7 changes: 3 additions & 4 deletions test/deriving/inline/foo-deriver/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(kind ppx_deriver)
(name ppx_foo_deriver)
(libraries ppxlib)
)
(kind ppx_deriver)
(name ppx_foo_deriver)
(libraries ppxlib))
13 changes: 8 additions & 5 deletions test/driver/attributes/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.08.0"))
(enabled_if
(>= %{ocaml_version} "4.08.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
21 changes: 12 additions & 9 deletions test/driver/instrument/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.08.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(alias runtest)
(enabled_if
(>= %{ocaml_version} "4.08.0"))
(deps
(:test test.ml)
(package ppxlib))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
13 changes: 8 additions & 5 deletions test/driver/non-compressible-suffix/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(rule
(alias runtest)
(enabled_if (>= %{ocaml_version} "4.08.0"))
(enabled_if
(>= %{ocaml_version} "4.08.0"))
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
6 changes: 4 additions & 2 deletions test/driver/skip-hash-bang/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
(test
(name test)
(modules test)
(flags (:standard -safe-string))
(preprocess (pps empty_rewriter)))
(flags
(:standard -safe-string))
(preprocess
(pps empty_rewriter)))
10 changes: 6 additions & 4 deletions test/driver/transformations/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
(deps
(:test test.ml)
(package ppxlib))
(action (chdir %{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
(action
(chdir
%{project_root}
(progn
(run expect-test %{test})
(diff? %{test} %{test}.corrected)))))
Loading

0 comments on commit 1af0b48

Please sign in to comment.