this repo has no description

Formatting

+70 -69
+3 -1
src/driver/bin/odoc_driver.ml
··· 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 75 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 53 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 93 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; 150 151 unit) ··· 244 245 type linked = Odoc_unit.any 246 247 - let link : warnings_tags:string list -> custom_layout:bool -> compiled list -> _ = 248 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; 148 Atomic.incr Stats.stats.compiled_units; 149 150 unit) ··· 243 244 type linked = Odoc_unit.any 245 246 + 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
··· 12 13 type linked 14 15 - val link : warnings_tags:string list -> custom_layout:bool -> compiled list -> linked list 16 17 val html_generate : 18 occurrence_file:Fpath.t ->
··· 12 13 type linked 14 15 + val link : 16 + warnings_tags:string list -> 17 + custom_layout:bool -> 18 + compiled list -> 19 + linked list 20 21 val html_generate : 22 occurrence_file:Fpath.t ->
+8 -5
src/driver/odoc.ml
··· 36 | [ (_, digest) ], deps -> Ok { digest; deps } 37 | _ -> Error (`Msg "odd") 38 39 - 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 58 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") 38 39 + let compile ~output_dir ~input_file:file ~includes ~warnings_tag ~parent_id = 40 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 =
+3 -6
src/loader/odoc_loader.ml
··· 256 | Make_root_error m -> error_msg filename m) 257 258 let read_cmti ~make_root ~parent ~filename ~warnings_tag = 259 - wrap_errors ~filename 260 - (read_cmti ~make_root ~parent ~filename ~warnings_tag) 261 262 let read_cmt ~make_root ~parent ~filename ~warnings_tag = 263 - wrap_errors ~filename 264 - (read_cmt ~make_root ~parent ~filename ~warnings_tag) 265 266 let read_impl ~make_root ~filename ~source_id = 267 wrap_errors ~filename (read_impl ~make_root ~source_id ~filename) 268 269 let read_cmi ~make_root ~parent ~filename ~warnings_tag = 270 - wrap_errors ~filename 271 - (read_cmi ~make_root ~parent ~filename ~warnings_tag) 272 273 let read_location = Doc_attr.read_location
··· 256 | Make_root_error m -> error_msg filename m) 257 258 let read_cmti ~make_root ~parent ~filename ~warnings_tag = 259 + wrap_errors ~filename (read_cmti ~make_root ~parent ~filename ~warnings_tag) 260 261 let read_cmt ~make_root ~parent ~filename ~warnings_tag = 262 + wrap_errors ~filename (read_cmt ~make_root ~parent ~filename ~warnings_tag) 263 264 let read_impl ~make_root ~filename ~source_id = 265 wrap_errors ~filename (read_impl ~make_root ~source_id ~filename) 266 267 let read_cmi ~make_root ~parent ~filename ~warnings_tag = 268 + wrap_errors ~filename (read_cmi ~make_root ~parent ~filename ~warnings_tag) 269 270 let read_location = Doc_attr.read_location
+18 -19
src/odoc/bin/main.ml
··· 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" ]) 154 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) 168 169 let dst ?create () = 170 let doc = "Output directory where the HTML tree is expected to be saved." in ··· 716 717 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" ]) 724 725 let link directories page_roots lib_roots input_file output_file 726 - current_package warnings_options open_modules custom_layout warnings_tags = 727 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 755 | 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 - )) 820 821 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 -> 159 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) 163 164 let dst ?create () = 165 let doc = "Output directory where the HTML tree is expected to be saved." in ··· 711 712 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" ]) 719 720 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)) 819 820 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
+1 -1
src/odoc/odoc_link.ml
··· 56 items = content_for_hidden_modules; 57 compiled = false; 58 removed = []; 59 - doc = { elements = []; warnings_tag = None}; 60 }; 61 expansion = None; 62 }
··· 56 items = content_for_hidden_modules; 57 compiled = false; 58 removed = []; 59 + doc = { elements = []; warnings_tag = None }; 60 }; 61 expansion = None; 62 }
+2 -1
src/odoc/rendering.ml
··· 33 34 let 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 37 | `Page page -> Ok (Renderer.document_of_page ~syntax page) 38 | `Module m -> Ok (Renderer.document_of_compilation_unit ~syntax m) 39 | `Impl _ ->
··· 33 34 let 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 } 12 in 13 Semantics.parse_reference reference 14 |> Error.handle_errors_and_warnings ~warnings_options
+2 -3
src/xref2/env.ml
··· 174 } 175 176 let 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 *) 180 181 let set_warnings_tags env tags = { env with warnings_tags = tags } 182
··· 174 } 175 176 let 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 *) 179 180 let set_warnings_tags env tags = { env with warnings_tags = tags } 181
+15 -20
src/xref2/link.ml
··· 232 p) 233 234 let rec comment_inline_element : 235 - loc:_ -> Env.t -> string option -> Comment.inline_element -> Comment.inline_element = 236 fun ~loc:_ env warnings_tag x -> 237 match x with 238 | `Styled (s, ls) -> 239 `Styled 240 ( s, 241 - List.map 242 - (with_location (comment_inline_element env warnings_tag)) 243 - ls ) 244 | `Reference (r, content) as orig -> ( 245 match 246 maybe_suppress env warnings_tag (fun () -> ··· 287 let map f x = List.rev_map f x |> List.rev in 288 map 289 (map (fun (cell, cell_type) -> 290 - ( comment_nestable_block_element_list env warnings_tag 291 - parent cell, 292 cell_type ))) 293 data 294 in ··· 335 and comment_nestable_block_element_list env warnings_tag parent 336 (xs : Comment.nestable_block_element Comment.with_location list) = 337 List.rev_map 338 - (with_location 339 - (comment_nestable_block_element env warnings_tag parent)) 340 xs 341 |> List.rev 342 ··· 344 match x with 345 | `Deprecated content -> 346 `Deprecated 347 - (comment_nestable_block_element_list env warnings_tag parent 348 - content) 349 | `Param (name, content) -> 350 `Param 351 ( name, 352 - comment_nestable_block_element_list env warnings_tag parent 353 - content ) 354 | `Raise ((`Reference (r, reference_content) as orig), content) -> ( 355 match 356 maybe_suppress env warnings_tag (fun () -> ··· 372 | `Raise ((`Code_span _ as orig), content) -> 373 `Raise 374 ( orig, 375 - comment_nestable_block_element_list env warnings_tag parent 376 - content ) 377 | `Return content -> 378 `Return 379 - (comment_nestable_block_element_list env warnings_tag parent 380 - content) 381 | `See (kind, target, content) -> 382 `See 383 ( kind, 384 target, 385 - comment_nestable_block_element_list env warnings_tag parent 386 - content ) 387 | `Before (version, content) -> 388 `Before 389 ( version, 390 - comment_nestable_block_element_list env warnings_tag parent 391 - content ) 392 | `Author _ | `Since _ | `Alert _ | `Version _ -> 393 x (* only contain primitives *) 394
··· 232 p) 233 234 let rec comment_inline_element : 235 + loc:_ -> 236 + Env.t -> 237 + string option -> 238 + Comment.inline_element -> 239 + Comment.inline_element = 240 fun ~loc:_ env warnings_tag x -> 241 match x with 242 | `Styled (s, ls) -> 243 `Styled 244 ( s, 245 + List.map (with_location (comment_inline_element env warnings_tag)) ls 246 + ) 247 | `Reference (r, content) as orig -> ( 248 match 249 maybe_suppress env warnings_tag (fun () -> ··· 290 let map f x = List.rev_map f x |> List.rev in 291 map 292 (map (fun (cell, cell_type) -> 293 + ( comment_nestable_block_element_list env warnings_tag parent cell, 294 cell_type ))) 295 data 296 in ··· 337 and comment_nestable_block_element_list env warnings_tag parent 338 (xs : Comment.nestable_block_element Comment.with_location list) = 339 List.rev_map 340 + (with_location (comment_nestable_block_element env warnings_tag parent)) 341 xs 342 |> List.rev 343 ··· 345 match x with 346 | `Deprecated content -> 347 `Deprecated 348 + (comment_nestable_block_element_list env warnings_tag parent content) 349 | `Param (name, content) -> 350 `Param 351 ( name, 352 + comment_nestable_block_element_list env warnings_tag parent content ) 353 | `Raise ((`Reference (r, reference_content) as orig), content) -> ( 354 match 355 maybe_suppress env warnings_tag (fun () -> ··· 371 | `Raise ((`Code_span _ as orig), content) -> 372 `Raise 373 ( orig, 374 + comment_nestable_block_element_list env warnings_tag parent content ) 375 | `Return content -> 376 `Return 377 + (comment_nestable_block_element_list env warnings_tag parent content) 378 | `See (kind, target, content) -> 379 `See 380 ( kind, 381 target, 382 + comment_nestable_block_element_list env warnings_tag parent content ) 383 | `Before (version, content) -> 384 `Before 385 ( version, 386 + comment_nestable_block_element_list env warnings_tag parent content ) 387 | `Author _ | `Since _ | `Alert _ | `Version _ -> 388 x (* only contain primitives *) 389