this repo has no description

Disable the missing root warning by default

It can be re-enabled via the command-line option

--enable-missing-root-warning

But since this is usually a build system issue rather than something
end-users will need to worry about, let's not complain about it.

Note that this will _not_ suppress warnings generated if references
aren't resolved - so if you explicitly have a reference to something
in a dependency library and it's not found when linking, you'll still
get a warning.

Fixes: #825

+22 -7
+2
src/model/error.ml
··· 1 1 open Result 2 2 3 + let enable_missing_root_warning = ref false 4 + 3 5 type full_location_payload = Odoc_parser.Warning.t = { 4 6 location : Location_.span; 5 7 message : string;
+2
src/model/error.mli
··· 1 1 type t 2 2 3 + val enable_missing_root_warning : bool ref 4 + 3 5 val make : 4 6 ?suggestion:string -> 5 7 ('a, Format.formatter, unit, Location_.span -> t) format4 ->
+12 -2
src/odoc/bin/main.ml
··· 82 82 let env = Arg.env_var "ODOC_PRINT_WARNINGS" ~doc in 83 83 Arg.(value & opt bool true & info ~docs ~doc ~env [ "print-warnings" ]) 84 84 in 85 + let enable_missing_root_warning = 86 + let doc = 87 + "Produce a warning when a root is missing. This is usually a build \ 88 + system problem so is disabled for users by default." 89 + in 90 + let env = Arg.env_var "ODOC_ENABLE_MISSING_ROOT_WARNING" ~doc in 91 + Arg.(value & flag & info ~docs ~doc ~env [ "enable-missing-root-warning" ]) 92 + in 85 93 Term.( 86 - const (fun warn_error print_warnings -> 94 + const (fun warn_error print_warnings enable_missing_root_warning -> 95 + Odoc_model.Error.enable_missing_root_warning := 96 + enable_missing_root_warning; 87 97 { Odoc_model.Error.warn_error; print_warnings }) 88 - $ warn_error $ print_warnings) 98 + $ warn_error $ print_warnings $ enable_missing_root_warning) 89 99 90 100 let dst ?create () = 91 101 let doc = "Output directory where the HTML tree is expected to be saved." in
+2 -1
src/xref2/lookup_failures.ml
··· 59 59 let catch_failures ~filename f = 60 60 let r, failures = with_ref acc [] f in 61 61 Error.catch_warnings (fun () -> 62 - raise_root_errors ~filename failures; 62 + if !Error.enable_missing_root_warning then 63 + raise_root_errors ~filename failures; 63 64 raise_warnings ~filename failures; 64 65 r) 65 66
+2 -2
test/xref2/multi_file_module_type_of.t/run.t
··· 26 26 odoc file for `Test0` - so there will be a warning when we run `odoc compile` 27 27 on test1.cmti: 28 28 29 - $ odoc compile --package foo test1.cmti 29 + $ odoc compile --package foo test1.cmti --enable-missing-root-warning 30 30 File "test1.cmti": 31 31 Warning: Couldn't find the following modules: 32 32 Test0 ··· 34 34 Similarly, module `T` also can not be expanded, therefore we expect 35 35 another warning when we run `odoc compile` on test2.cmti: 36 36 37 - $ odoc compile --package foo test2.cmti -I . 37 + $ odoc compile --package foo test2.cmti -I . --enable-missing-root-warning 38 38 File "test2.cmti": 39 39 Warning: Couldn't find the following modules: 40 40 Test1
+1 -1
test/xref2/unexpanded_module_type_of.t/run.t
··· 15 15 Compiling an odoc file for `test` without compiling one for `test0` 16 16 should _not_ result in an exception, merely a warning. 17 17 18 - $ odoc compile --package test test.cmti 18 + $ odoc compile --package test test.cmti --enable-missing-root-warning 19 19 File "test.cmti": 20 20 Warning: Couldn't find the following modules: 21 21 Test0
+1 -1
test/xref2/warnings.t/run.t
··· 28 28 29 29 A contains linking errors: 30 30 31 - $ odoc link a.odoc 31 + $ odoc link a.odoc --enable-missing-root-warning 32 32 File "a.odoc": 33 33 Warning: Couldn't find the following modules: 34 34 B