Skip to content

Commit

Permalink
Print derivers as well as registered transformations
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored and jeremiedimino committed Dec 15, 2018
1 parent fa298d1 commit d7e12a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions ocaml-migrate-parsetree.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ build: [
]
depends: [
"result"
"ppx_derivers"
"dune" {build}
]
available: ocaml-version >= "4.02.0"
2 changes: 1 addition & 1 deletion src/jbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
((name migrate_parsetree)
(public_name ocaml-migrate-parsetree)
(wrapped false)
(libraries (compiler-libs.common result))
(libraries (compiler-libs.common result ppx_derivers))
(flags (:standard -open Result))
(modules (:standard \ migrate_parsetree_driver_main))
(preprocess (action (run ${exe:../tools/pp.exe} ${read:ast-version} ${<})))
Expand Down
16 changes: 13 additions & 3 deletions src/migrate_parsetree_driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,20 @@ let process_file ~config ~output ~output_mode ~embed_errors file =
()

let print_transformations () =
let print_group name = function
| [] -> ()
| names ->
Printf.printf "%s:\n" name;
List.iter (Printf.printf "%s\n") names
in
all_rewriters ()
|> List.iter (fun r ->
rewriter_group_names r
|> List.iter (Printf.printf "%s\n"))
|> List.map rewriter_group_names
|> List.concat
|> print_group "Registered Transformations";
Ppx_derivers.derivers ()
|> List.map (fun (x, _) -> x)
|> print_group "Registered Derivers"


let run_as_standalone_driver () =
let request_print_transformations = ref false in
Expand Down

0 comments on commit d7e12a2

Please sign in to comment.