Skip to content

Commit

Permalink
Use greedy extension for -intf-suffix
Browse files Browse the repository at this point in the history
Since reason sources are named as .{re,rei}.{ml,mli}
  • Loading branch information
rgrinberg committed Jul 14, 2017
1 parent 7be14ac commit c82a5cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ module Filename = struct
let extension fn =
let i = extension_start fn in
String.sub fn ~pos:i ~len:(String.length fn - i)

(* test.x.y.z -> .x.y.z *)
let rec greedy_extension fn =
match split_extension fn with
| _, "" -> ""
| (f, e) when extension f = "" -> e
| (f, e) -> greedy_extension f ^ "." ^ e
end

module Option = struct
Expand Down
2 changes: 1 addition & 1 deletion src/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let build_cm sctx ?sandbox ~dynlink ~flags ~cm_kind ~(dep_graph:Ocamldep.dep_gra
cmi exists and reads it instead of re-creating it, which
could create a race condition. *)
([ "-intf-suffix"
; Filename.extension m.impl.name
; Filename.greedy_extension m.impl.name
],
[Module.cm_file m ~dir Cmi], [])
| Cmi, None -> assert false
Expand Down

0 comments on commit c82a5cb

Please sign in to comment.