Use absolute paths for ppx drivers in .merlin files (#201)

Fixes #196 and #199
This commit is contained in:
Jérémie Dimino 2017-07-28 16:49:45 +01:00 committed by GitHub
parent b5f0b85e56
commit ea377efbbb
2 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,10 @@
would do: `-I <path> file.cmxa`, now it does `-I <path>
<path>/file.cmxa`. Fixes #118 and #177
- Use an absolute path for ppx drivers in `.merlin` files. Merlin
<3.0.0 used to run ppx commands from the directory where the
`.merlin` was present but this is no longer the case
- Allow to use `jbuilder install` in contexts other than opam; if
`ocamlfind` is present in the `PATH` and the user didn't pass
`--prefix` or `--libdir` explicitly, use the output of `ocamlfind

View File

@ -11,12 +11,15 @@ type t =
; libname : string option
}
let ppx_flags sctx ~dir ~src_dir { preprocess; libname; _ } =
(* This must be forced after we change the cwd to the workspace root *)
let root_absolute_name = lazy (Sys.getcwd ())
let ppx_flags sctx ~dir ~src_dir:_ { preprocess; libname; _ } =
match preprocess with
| Pps { pps; flags } ->
let exe = SC.PP.get_ppx_driver sctx pps ~dir ~dep_kind:Optional in
let command =
List.map (Path.reach exe ~from:src_dir
List.map (Filename.concat (Lazy.force root_absolute_name) (Path.to_string exe)
:: "--as-ppx"
:: SC.PP.cookie_library_name libname
@ flags)