···71 in
72 Compile.init_stats units;
73 let compiled = Compile.compile ~partial_dir:odoc_dir units in
74- let linked = Compile.link ~warnings_tags:packages ~custom_layout:false compiled in
0075 let occurrence_file =
76 let output =
77 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
···71 in
72 Compile.init_stats units;
73 let compiled = Compile.compile ~partial_dir:odoc_dir units in
74+ let linked =
75+ Compile.link ~warnings_tags:packages ~custom_layout:false compiled
76+ in
77 let occurrence_file =
78 let output =
79 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
+3-1
src/driver/bin/odoc_driver_monorepo.ml
···49 in
50 Compile.init_stats units;
51 let compiled = Compile.compile ~partial_dir:odoc_dir units in
52- let linked = Compile.link ~warnings_tags:[] ~custom_layout:true compiled in
0053 let occurrence_file =
54 let output =
55 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
···49 in
50 Compile.init_stats units;
51 let compiled = Compile.compile ~partial_dir:odoc_dir units in
52+ let linked =
53+ Compile.link ~warnings_tags:[] ~custom_layout:true compiled
54+ in
55 let occurrence_file =
56 let output =
57 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
+4-1
src/driver/bin/odoc_driver_voodoo.ml
···89 match actions with
90 | CompileOnly -> ()
91 | LinkAndGen | All ->
92- let linked = Compile.link ~warnings_tags:[package_name] ~custom_layout:false compiled in
00093 let occurrence_file =
94 let output =
95 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
···89 match actions with
90 | CompileOnly -> ()
91 | LinkAndGen | All ->
92+ let linked =
93+ Compile.link ~warnings_tags:[ package_name ] ~custom_layout:false
94+ compiled
95+ in
96 let occurrence_file =
97 let output =
98 Fpath.( / ) odoc_dir "occurrences-all.odoc-occurrences"
+3-3
src/driver/compile.ml
···144 in
145 Odoc.compile ~output_dir:unit.output_dir
146 ~input_file:unit.input_file ~includes
147- ~warnings_tag:unit.pkgname
148- ~parent_id:unit.parent_id;
149 Atomic.incr Stats.stats.compiled_units;
150151 unit)
···244245type linked = Odoc_unit.any
246247-let link : warnings_tags:string list -> custom_layout:bool -> compiled list -> _ =
0248 fun ~warnings_tags ~custom_layout compiled ->
249 let link : compiled -> linked =
250 fun c ->
···144 in
145 Odoc.compile ~output_dir:unit.output_dir
146 ~input_file:unit.input_file ~includes
147+ ~warnings_tag:unit.pkgname ~parent_id:unit.parent_id;
0148 Atomic.incr Stats.stats.compiled_units;
149150 unit)
···243244type linked = Odoc_unit.any
245246+let link : warnings_tags:string list -> custom_layout:bool -> compiled list -> _
247+ =
248 fun ~warnings_tags ~custom_layout compiled ->
249 let link : compiled -> linked =
250 fun c ->
+5-1
src/driver/compile.mli
···1213type linked
1415-val link : warnings_tags:string list -> custom_layout:bool -> compiled list -> linked list
00001617val html_generate :
18 occurrence_file:Fpath.t ->
···1213type linked
1415+val link :
16+ warnings_tags:string list ->
17+ custom_layout:bool ->
18+ compiled list ->
19+ linked list
2021val html_generate :
22 occurrence_file:Fpath.t ->
+8-5
src/driver/odoc.ml
···36 | [ (_, digest) ], deps -> Ok { digest; deps }
37 | _ -> Error (`Msg "odd")
3839-let compile ~output_dir ~input_file:file ~includes ~warnings_tag ~parent_id
40- =
41 let open Cmd in
42 let includes =
43 Fpath.Set.fold
···54 %% includes % "--enable-missing-root-warning"
55 in
56 let cmd = cmd % "--parent-id" % Id.to_string parent_id in
57- let cmd = match warnings_tag with None -> cmd | Some tag -> cmd % "--warnings-tag" % tag in
000058 let desc = Printf.sprintf "Compiling %s" (Fpath.to_string file) in
59 ignore
60 @@ Cmd_outputs.submit
···161 if Fpath.to_string file = "stdlib.odoc" then cmd % "--open=\"\"" else cmd
162 in
163 let cmd =
164- List.fold_left (fun acc k -> acc % "--warnings-tags" % k) cmd
165- warnings_tags in
166 let desc = Printf.sprintf "Linking %s" (Fpath.to_string file) in
167 let cmd = if custom_layout then cmd % "--custom-layout" else cmd in
168 let log =
···36 | [ (_, digest) ], deps -> Ok { digest; deps }
37 | _ -> Error (`Msg "odd")
3839+let compile ~output_dir ~input_file:file ~includes ~warnings_tag ~parent_id =
040 let open Cmd in
41 let includes =
42 Fpath.Set.fold
···53 %% includes % "--enable-missing-root-warning"
54 in
55 let cmd = cmd % "--parent-id" % Id.to_string parent_id in
56+ let cmd =
57+ match warnings_tag with
58+ | None -> cmd
59+ | Some tag -> cmd % "--warnings-tag" % tag
60+ in
61 let desc = Printf.sprintf "Compiling %s" (Fpath.to_string file) in
62 ignore
63 @@ Cmd_outputs.submit
···164 if Fpath.to_string file = "stdlib.odoc" then cmd % "--open=\"\"" else cmd
165 in
166 let cmd =
167+ List.fold_left (fun acc k -> acc % "--warnings-tags" % k) cmd warnings_tags
168+ in
169 let desc = Printf.sprintf "Linking %s" (Fpath.to_string file) in
170 let cmd = if custom_layout then cmd % "--custom-layout" else cmd in
171 let log =
···144 in
145 let warnings_tag =
146 let doc =
147- "Warnings tag. This is useful when you want to declare that \
148- warnings that would be generated resolving the references defined in \
149- this unit should be ignored if they end up in expansions in other \
150- units. When linking, only warnings with specified tags are reported."
151 in
152 let env = Arg.env_var "ODOC_WARNINGS_TAG" ~doc in
153- Arg.(value & opt (some string) None & info ~docs ~doc ~env [ "warnings-tag" ])
0154 in
155 Term.(
156 const
157- (fun
158- warn_error
159- print_warnings
160- enable_missing_root_warning
161- warnings_tag
162- ->
163 Odoc_model.Error.enable_missing_root_warning :=
164 enable_missing_root_warning;
165 { Odoc_model.Error.warn_error; print_warnings; warnings_tag })
166- $ warn_error $ print_warnings $ enable_missing_root_warning
167- $ warnings_tag)
168169let dst ?create () =
170 let doc = "Output directory where the HTML tree is expected to be saved." in
···716717 let warnings_tags =
718 let doc =
719- "Warnings tags. Only report warnings in references that have been compiled \
720- with these specific tags. Can be passed multiple times."
721 in
722 let env = Arg.env_var "ODOC_WARNINGS_TAGS" ~doc in
723 Arg.(value & opt_all string [] & info ~docs ~doc ~env [ "warnings-tags" ])
724725 let link directories page_roots lib_roots input_file output_file
726- current_package warnings_options open_modules custom_layout warnings_tags =
0727 let input = Fs.File.of_string input_file in
728 let output = get_output_file ~output_file ~input in
729 let check () =
···751 let resolver =
752 Resolver.create ~important_digests:false ~directories ~open_modules ~roots
753 in
754- match Odoc_link.from_odoc ~resolver ~warnings_options ~warnings_tags input output with
000755 | Error _ as e -> e
756 | Ok _ -> Ok ()
757···815 Term.(
816 const handle_error
817 $ (const link $ odoc_file_directories $ page_roots $ lib_roots $ input
818- $ dst $ current_package $ warnings_options $ open_modules $ custom_layout $ warnings_tags
819- ))
820821 let info ~docs =
822 let man =
···144 in
145 let warnings_tag =
146 let doc =
147+ "Warnings tag. This is useful when you want to declare that warnings \
148+ that would be generated resolving the references defined in this unit \
149+ should be ignored if they end up in expansions in other units. When \
150+ linking, only warnings with specified tags are reported."
151 in
152 let env = Arg.env_var "ODOC_WARNINGS_TAG" ~doc in
153+ Arg.(
154+ value & opt (some string) None & info ~docs ~doc ~env [ "warnings-tag" ])
155 in
156 Term.(
157 const
158+ (fun warn_error print_warnings enable_missing_root_warning warnings_tag ->
00000159 Odoc_model.Error.enable_missing_root_warning :=
160 enable_missing_root_warning;
161 { Odoc_model.Error.warn_error; print_warnings; warnings_tag })
162+ $ warn_error $ print_warnings $ enable_missing_root_warning $ warnings_tag)
0163164let dst ?create () =
165 let doc = "Output directory where the HTML tree is expected to be saved." in
···711712 let warnings_tags =
713 let doc =
714+ "Warnings tags. Only report warnings in references that have been \
715+ compiled with these specific tags. Can be passed multiple times."
716 in
717 let env = Arg.env_var "ODOC_WARNINGS_TAGS" ~doc in
718 Arg.(value & opt_all string [] & info ~docs ~doc ~env [ "warnings-tags" ])
719720 let link directories page_roots lib_roots input_file output_file
721+ current_package warnings_options open_modules custom_layout warnings_tags
722+ =
723 let input = Fs.File.of_string input_file in
724 let output = get_output_file ~output_file ~input in
725 let check () =
···747 let resolver =
748 Resolver.create ~important_digests:false ~directories ~open_modules ~roots
749 in
750+ match
751+ Odoc_link.from_odoc ~resolver ~warnings_options ~warnings_tags input
752+ output
753+ with
754 | Error _ as e -> e
755 | Ok _ -> Ok ()
756···814 Term.(
815 const handle_error
816 $ (const link $ odoc_file_directories $ page_roots $ lib_roots $ input
817+ $ dst $ current_package $ warnings_options $ open_modules $ custom_layout
818+ $ warnings_tags))
819820 let info ~docs =
821 let man =
+2-2
src/odoc/compile.ml
···400 let result =
401 Error.catch_errors_and_warnings (fun () ->
402 resolve_and_substitute ~resolver ~make_root ~hidden
403- ~warnings_tag:warnings_options.warnings_tag parent_id
404- input input_type)
405 in
406 (* Extract warnings to write them into the output file *)
407 let _, warnings = Error.unpack_warnings result in
···400 let result =
401 Error.catch_errors_and_warnings (fun () ->
402 resolve_and_substitute ~resolver ~make_root ~hidden
403+ ~warnings_tag:warnings_options.warnings_tag parent_id input
404+ input_type)
405 in
406 (* Extract warnings to write them into the output file *)
407 let _, warnings = Error.unpack_warnings result in
···3334let document_of_input ~resolver ~warnings_options ~syntax input =
35 let output = Fs.File.(set_ext ".odocl" input) in
36- Odoc_link.from_odoc ~resolver ~warnings_options ~warnings_tags:[] input output >>= function
037 | `Page page -> Ok (Renderer.document_of_page ~syntax page)
38 | `Module m -> Ok (Renderer.document_of_compilation_unit ~syntax m)
39 | `Impl _ ->
···3334let document_of_input ~resolver ~warnings_options ~syntax input =
35 let output = Fs.File.(set_ext ".odocl" input) in
36+ Odoc_link.from_odoc ~resolver ~warnings_options ~warnings_tags:[] input output
37+ >>= function
38 | `Page page -> Ok (Renderer.document_of_page ~syntax page)
39 | `Module m -> Ok (Renderer.document_of_compilation_unit ~syntax m)
40 | `Impl _ ->
+1-5
src/odoc/url.ml
···8 let reference =
9 let open Odoc_model in
10 let warnings_options =
11- {
12- Error.warn_error = true;
13- print_warnings = true;
14- warnings_tag = None;
15- }
16 in
17 Semantics.parse_reference reference
18 |> Error.handle_errors_and_warnings ~warnings_options
···8 let reference =
9 let open Odoc_model in
10 let warnings_options =
11+ { Error.warn_error = true; print_warnings = true; warnings_tag = None }
000012 in
13 Semantics.parse_reference reference
14 |> Error.handle_errors_and_warnings ~warnings_options
+2-3
src/xref2/env.ml
···174}
175176let should_suppress_warnings env opt =
177- match opt with
178- | None -> false
179- | Some x -> not (List.mem x env.warnings_tags) (* Suppress warnings unless the tag is in the list *)
180181let set_warnings_tags env tags = { env with warnings_tags = tags }
182
···174}
175176let should_suppress_warnings env opt =
177+ match opt with None -> false | Some x -> not (List.mem x env.warnings_tags)
178+(* Suppress warnings unless the tag is in the list *)
0179180let set_warnings_tags env tags = { env with warnings_tags = tags }
181