Skip to content

Commit a3cfeb9

Browse files
panglesdjonludlam
authored andcommitted
Odoc driver: abstract and improve type for compiled files
Signed-off-by: Paul-Elliot <peada@free.fr>
1 parent 714ef26 commit a3cfeb9

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/driver/compile.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
type ty = Module of Packages.modulety | Mld of Packages.mld
44

5+
type impl = { impl : Fpath.t; src : Fpath.t }
6+
57
type compiled = {
68
m : ty;
79
output_dir : Fpath.t;
810
output_file : Fpath.t;
911
include_dirs : Fpath.Set.t;
10-
impl : (Fpath.t * Fpath.t) option;
12+
impl : impl option;
1113
}
1214

1315
let mk_byhash (pkgs : Packages.t Util.StringMap.t) =
@@ -100,7 +102,7 @@ let compile output_dir all =
100102
Odoc.compile_impl ~output_dir ~input_file:impl.mip_path
101103
~includes ~parent_id:impl.mip_parent_id ~source_id:si.src_id;
102104
Atomic.incr Stats.stats.compiled_impls;
103-
Some (output_file, si.src_path)
105+
Some { impl = output_file; src = si.src_path }
104106
| None -> None)
105107
| None -> None
106108
in
@@ -168,11 +170,11 @@ let link : compiled list -> _ =
168170
let includes = Fpath.Set.add c.output_dir c.include_dirs in
169171
let impl =
170172
match c.impl with
171-
| Some (x, y) ->
172-
Logs.debug (fun m -> m "Linking impl: %a" Fpath.pp x);
173-
Odoc.link ~input_file:x ~includes ();
173+
| Some { impl; src } ->
174+
Logs.debug (fun m -> m "Linking impl: %a" Fpath.pp impl);
175+
Odoc.link ~input_file:impl ~includes ();
174176
Atomic.incr Stats.stats.linked_impls;
175-
[ { output_file = Fpath.(set_ext "odocl" x); src = Some y } ]
177+
[ { output_file = Fpath.(set_ext "odocl" impl); src = Some src } ]
176178
| None -> []
177179
in
178180
match c.m with

src/driver/compile.mli

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
type ty = Module of Packages.modulety | Mld of Packages.mld
2-
3-
type compiled = {
4-
m : ty;
5-
output_dir : Fpath.t;
6-
output_file : Fpath.t;
7-
include_dirs : Fpath.Set.t;
8-
impl : (Fpath.t * Fpath.t) option;
9-
}
1+
type compiled
102

113
val init_stats : Packages.set -> unit
124

135
val compile : Fpath.t -> Packages.set -> compiled list
146

15-
type linked = { output_file : Fpath.t; src : Fpath.t option }
7+
type linked
168

179
val link : compiled list -> linked list
1810

0 commit comments

Comments
 (0)