Skip to content

Commit

Permalink
Merge pull request #47 from lindig/master
Browse files Browse the repository at this point in the history
Simplify PPX processing
  • Loading branch information
gaborigloi authored Sep 3, 2018
2 parents d7dcb65 + 086d8b6 commit a9fb48b
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions http-svr/jbuild
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
(* -*- tuareg -*- *)
#require "unix"
(jbuild_version 1)

let flags = function
| [] -> ""
| pkgs ->
let cmd = "ocamlfind ocamlc -verbose" ^ (
List.fold_left (fun acc pkg -> acc ^ " -package " ^ pkg) "" pkgs
) in
let ic = Unix.open_process_in
(cmd ^ " | grep -oEe '-ppx (\"([^\"\\]|\\.)+\"|\\w+)'")
in
let rec go ic acc =
try go ic (acc ^ " " ^ input_line ic) with End_of_file -> close_in ic; acc
in
go ic ""


let rewriters = ["ppx_deriving_rpc"]
let flags = flags rewriters

let () = Printf.ksprintf Jbuild_plugin.V1.send {|
(library
((name httpsvr)
(public_name http-svr)
(wrapped false)
(flags (:standard -w -37-39 %s))
(flags (:standard -w -37-39))
(modules (:standard \ (http_test radix_tree_test test_client test_server)))
(preprocess (pps (ppx_deriving_rpc)))
(libraries (astring
rpclib
sha
Expand Down Expand Up @@ -90,4 +71,3 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
(deps (test_client.exe test_server.exe client_server_test.sh))
(action (run bash client_server_test.sh))
))
|} flags

0 comments on commit a9fb48b

Please sign in to comment.