@@ -25,7 +25,7 @@ let odoc = ref (Cmd.v "odoc")
25
25
let compile_deps f =
26
26
let cmd = Cmd. (! odoc % " compile-deps" % Fpath. to_string f) in
27
27
let desc = Printf. sprintf " Compile deps for %s" (Fpath. to_string f) in
28
- let deps = Cmd_outputs. submit desc cmd None in
28
+ let deps = Cmd_outputs. submit None desc cmd None in
29
29
let l = List. filter_map (Astring.String. cut ~sep: " " ) deps in
30
30
let basename = Fpath. (basename (f |> rem_ext)) |> String. capitalize_ascii in
31
31
match List. partition (fun (n , _ ) -> basename = n) l with
@@ -49,9 +49,10 @@ let compile ~output_dir ~input_file:file ~includes ~parent_id =
49
49
in
50
50
let cmd = cmd % " --parent-id" % Id. to_string parent_id in
51
51
let desc = Printf. sprintf " Compiling %s" (Fpath. to_string file) in
52
- let lines = Cmd_outputs. submit desc cmd output_file in
53
- Cmd_outputs. (
54
- add_prefixed_output cmd compile_output (Fpath. to_string file) lines)
52
+ ignore
53
+ @@ Cmd_outputs. submit
54
+ (Some (`Compile , Fpath. to_string file))
55
+ desc cmd output_file
55
56
56
57
let compile_asset ~output_dir ~name ~parent_id =
57
58
let open Cmd in
@@ -65,8 +66,7 @@ let compile_asset ~output_dir ~name ~parent_id =
65
66
66
67
let cmd = cmd % " --parent-id" % Id. to_string parent_id in
67
68
let desc = Printf. sprintf " Compiling %s" name in
68
- let lines = Cmd_outputs. submit desc cmd output_file in
69
- Cmd_outputs. (add_prefixed_output cmd compile_output name lines)
69
+ ignore @@ Cmd_outputs. submit (Some (`Compile , name)) desc cmd output_file
70
70
71
71
let compile_impl ~output_dir ~input_file :file ~includes ~parent_id ~source_id =
72
72
let open Cmd in
@@ -91,9 +91,10 @@ let compile_impl ~output_dir ~input_file:file ~includes ~parent_id ~source_id =
91
91
let desc =
92
92
Printf. sprintf " Compiling implementation %s" (Fpath. to_string file)
93
93
in
94
- let lines = Cmd_outputs. submit desc cmd output_file in
95
- Cmd_outputs. (
96
- add_prefixed_output cmd compile_output (Fpath. to_string file) lines)
94
+ ignore
95
+ @@ Cmd_outputs. submit
96
+ (Some (`Compile , Fpath. to_string file))
97
+ desc cmd output_file
97
98
98
99
let doc_args docs =
99
100
let open Cmd in
@@ -137,11 +138,10 @@ let link ?(ignore_output = false) ~input_file:file ?output_file ~includes ~docs
137
138
if Fpath. to_string file = " stdlib.odoc" then cmd % " --open=\"\" " else cmd
138
139
in
139
140
let desc = Printf. sprintf " Linking %s" (Fpath. to_string file) in
140
-
141
- let lines = Cmd_outputs. submit desc cmd (Some output_file) in
142
- if not ignore_output then
143
- Cmd_outputs. (
144
- add_prefixed_output cmd link_output (Fpath. to_string file) lines)
141
+ let log =
142
+ if ignore_output then None else Some (`Link , Fpath. to_string file)
143
+ in
144
+ ignore @@ Cmd_outputs. submit log desc cmd (Some output_file)
145
145
146
146
let compile_index ?(ignore_output = false ) ~output_file ?occurrence_file ~json
147
147
~docs ~libs () =
@@ -161,10 +161,10 @@ let compile_index ?(ignore_output = false) ~output_file ?occurrence_file ~json
161
161
let desc =
162
162
Printf. sprintf " Generating index for %s" (Fpath. to_string output_file)
163
163
in
164
- let lines = Cmd_outputs. submit desc cmd ( Some output_file) in
165
- if not ignore_output then
166
- Cmd_outputs. (
167
- add_prefixed_output cmd index_output ( Fpath. to_string output_file) lines )
164
+ let log =
165
+ if ignore_output then None else Some ( `Index , Fpath. to_string output_file)
166
+ in
167
+ ignore @@ Cmd_outputs. submit log desc cmd ( Some output_file)
168
168
169
169
let html_generate ~output_dir ?index ?(ignore_output = false )
170
170
?(search_uris = [] ) ?(as_json = false ) ~input_file :file () =
@@ -182,10 +182,10 @@ let html_generate ~output_dir ?index ?(ignore_output = false)
182
182
in
183
183
let cmd = if as_json then cmd % " --as-json" else cmd in
184
184
let desc = Printf. sprintf " Generating HTML for %s" (Fpath. to_string file) in
185
- let lines = Cmd_outputs. submit desc cmd None in
186
- if not ignore_output then
187
- Cmd_outputs. (
188
- add_prefixed_output cmd generate_output ( Fpath. to_string file) lines)
185
+ let log =
186
+ if ignore_output then None else Some ( `Generate , Fpath. to_string file)
187
+ in
188
+ ignore @@ Cmd_outputs. submit log desc cmd None
189
189
190
190
let html_generate_asset ~output_dir ?(ignore_output = false ) ~input_file :file
191
191
~asset_path () =
@@ -195,10 +195,10 @@ let html_generate_asset ~output_dir ?(ignore_output = false) ~input_file:file
195
195
% p asset_path
196
196
in
197
197
let desc = Printf. sprintf " Copying asset %s" (Fpath. to_string file) in
198
- let lines = Cmd_outputs. submit desc cmd None in
199
- if not ignore_output then
200
- Cmd_outputs. (
201
- add_prefixed_output cmd generate_output ( Fpath. to_string file) lines)
198
+ let log =
199
+ if ignore_output then None else Some ( `Generate , Fpath. to_string file)
200
+ in
201
+ ignore @@ Cmd_outputs. submit log desc cmd None
202
202
203
203
let html_generate_source ~output_dir ?(ignore_output = false ) ~source
204
204
?(search_uris = [] ) ?(as_json = false ) ~input_file :file () =
@@ -216,26 +216,25 @@ let html_generate_source ~output_dir ?(ignore_output = false) ~source
216
216
let cmd = if as_json then cmd % " --as-json" else cmd in
217
217
218
218
let desc = Printf. sprintf " Generating HTML for %s" (Fpath. to_string source) in
219
- let lines = Cmd_outputs. submit desc cmd None in
220
- if not ignore_output then
221
- Cmd_outputs. (
222
- add_prefixed_output cmd generate_output ( Fpath. to_string source) lines)
219
+ let log =
220
+ if ignore_output then None else Some ( `Generate , Fpath. to_string source)
221
+ in
222
+ ignore @@ Cmd_outputs. submit log desc cmd None
223
223
224
224
let support_files path =
225
225
let open Cmd in
226
226
let cmd = ! odoc % " support-files" % " -o" % Fpath. to_string path in
227
227
let desc = " Generating support files" in
228
- Cmd_outputs. submit desc cmd None
228
+ Cmd_outputs. submit None desc cmd None
229
229
230
230
let count_occurrences ~input ~output =
231
231
let open Cmd in
232
232
let input = Cmd. of_values Fpath. to_string input in
233
233
let output_c = v " -o" % p output in
234
234
let cmd = ! odoc % " count-occurrences" %% input %% output_c in
235
235
let desc = " Counting occurrences" in
236
- let lines = Cmd_outputs. submit desc cmd None in
237
- Cmd_outputs. (
238
- add_prefixed_output cmd generate_output (Fpath. to_string output) lines)
236
+ let log = Some (`Count_occurrences , Fpath. to_string output) in
237
+ ignore @@ Cmd_outputs. submit log desc cmd None
239
238
240
239
let source_tree ?(ignore_output = false ) ~parent ~output file =
241
240
let open Cmd in
@@ -244,19 +243,22 @@ let source_tree ?(ignore_output = false) ~parent ~output file =
244
243
! odoc % " source-tree" % " -I" % " ." %% parent % " -o" % p output % p file
245
244
in
246
245
let desc = Printf. sprintf " Source tree for %s" (Fpath. to_string file) in
247
- let lines = Cmd_outputs. submit desc cmd None in
248
- if not ignore_output then
249
- Cmd_outputs. (
250
- add_prefixed_output cmd source_tree_output ( Fpath. to_string file) lines)
246
+ let log =
247
+ if ignore_output then None else Some ( `Source_tree , Fpath. to_string file)
248
+ in
249
+ ignore @@ Cmd_outputs. submit log desc cmd None
251
250
252
251
let classify dirs =
253
252
let open Cmd in
254
253
let cmd = List. fold_left (fun cmd d -> cmd % p d) (! odoc % " classify" ) dirs in
255
254
let desc =
256
255
Format. asprintf " Classifying [%a]" (Fmt. (list ~sep: sp) Fpath. pp) dirs
257
256
in
257
+ let log =
258
+ Some (`Classify , String. concat " ," (List. map Fpath. to_string dirs))
259
+ in
258
260
let lines =
259
- Cmd_outputs. submit desc cmd None |> List. filter (fun l -> l <> " " )
261
+ Cmd_outputs. submit log desc cmd None |> List. filter (fun l -> l <> " " )
260
262
in
261
263
List. map
262
264
(fun line ->
0 commit comments