···3737let build ~env _ config_filename dev no_theme =
3838 let config = Config_parser.parse_forest_config_file config_filename in
3939 Logs.debug (fun m -> m "Parsed config file %s" config_filename);
4040- let forest = Forester.plant_raw_forest_from_dirs ~env ~dev ~config in
4040+ let forest = Forester.compile ~env ~dev ~config in
4141 forest
4242 |> State.diagnostics
4343 |> Diagnostic_store.iter (fun _ d -> List.iter Reporter.Tty.display d);
···4949let export ~env _ config_filename dev =
5050 let config = Config_parser.parse_forest_config_file config_filename in
5151 Logs.debug (fun m -> m "Parsed config file %s" config_filename);
5252- let forest = Forester.plant_raw_forest_from_dirs ~env ~dev ~config in
5252+ let forest = Forester.compile ~env ~dev ~config in
5353 forest
5454 |> State.diagnostics
5555 |> Diagnostic_store.iter (fun _ d -> List.iter Reporter.Tty.display d);
5656- Forester.render_forest ~dev ~forest;
5757- (* let dirs_to_copy = (if not no_theme then [config.theme] else []) in *)
5858- (* let@ dir_to_copy = List.iter @~ dirs_to_copy in *)
5956 Forester.export ~forest
60576158let new_tree ~env config_filename prefix template random =
6259 let@ () = Reporter.silence in
6360 let config = Config_parser.parse_forest_config_file config_filename in
6464- let forest = Forester.plant_raw_forest_from_dirs ~env ~dev: true ~config in
6161+ let forest = Forester.compile ~env ~dev: true ~config in
6562 let mode = if random then `Random else `Sequential in
6663 let new_tree = Forester.create_tree ~env ~prefix ~template ~mode ~config ~forest in
6764 Format.printf "%s.tree\n" new_tree
···6966let complete ~env config_filename title =
7067 let@ () = Reporter.silence in
7168 let config = Config_parser.parse_forest_config_file config_filename in
7272- let forest = Forester.plant_raw_forest_from_dirs ~env ~dev: true ~config in
6969+ let forest = Forester.compile ~env ~dev: true ~config in
7370 let@ iri, title = Seq.iter @~ Forester.complete ~forest title in
7471 Format.printf "%a, %s\n" pp_iri iri title
75727673let query_all ~env config_filename =
7774 let@ () = Reporter.silence in
7875 let config = Config_parser.parse_forest_config_file config_filename in
7979- let forest = Forester.plant_raw_forest_from_dirs ~env ~config ~dev: true in
7676+ let forest = Forester.compile ~env ~config ~dev: true in
8077 Format.printf "%s" @@
8178 Forester.json_manifest ~dev: true ~forest
8279
+3
lib/core/Reporter.ml
···60606161type diagnostic = Message.t Asai.Diagnostic.t
62626363+let log pp s =
6464+ Logs.app (fun m -> m " ○ %a...@." pp s)
6565+6366let profile msg body =
6467 let before = Unix.gettimeofday () in
6568 let result = body () in
+57
lib/core/Reporter.mli
···11+(*
22+ * SPDX-FileCopyrightText: 2024 The Forester Project Contributors
33+ *
44+ * SPDX-License-Identifier: GPL-3.0-or-later
55+ *)
66+77+module Message :
88+sig
99+ type t =
1010+ Tree_not_found of Base.iri
1111+ | Duplicate_tree of Base.iri
1212+ | Parse_error
1313+ | Type_error
1414+ | Type_warning
1515+ | Resolution_error
1616+ | Resolution_warning
1717+ | Duplicate_attribute
1818+ | Unhandled_case
1919+ | Transclusion_loop
2020+ | Internal_error
2121+ | Configuration_error
2222+ | Initialization_warning
2323+ | Routing_error
2424+ | Profiling
2525+ | External_error
2626+ | Resource_not_found
2727+ | Broken_link
2828+ | IO_error
2929+ | Log
3030+ val pp :
3131+ Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
3232+ val show : t -> Ppx_deriving_runtime.string
3333+ val default_severity : t -> Asai.Diagnostic.severity
3434+ val short_code : t -> string
3535+end
3636+3737+include module type of Asai.Reporter.Make(Message)
3838+module Tty : module type of Asai.Tty.Make(Message)
3939+4040+type diagnostic = Message.t Asai.Diagnostic.t
4141+val log : (Format.formatter -> 'a -> unit) -> 'a -> unit
4242+val profile : string -> (unit -> 'a) -> 'a
4343+val easy_run : (unit -> 'a) -> 'a
4444+val silence : (unit -> 'a) -> 'a
4545+val test_run : (unit -> 'a) -> 'a
4646+val lsp_run :
4747+ ?init_loc: Asai__.Range.t ->
4848+ ?init_backtrace: Asai__.Diagnostic.backtrace ->
4949+ ('a -> Message.t Asai__.Diagnostic.t list -> unit) ->
5050+ 'a ->
5151+ (unit -> unit) ->
5252+ unit
5353+val ignore :
5454+ ?init_loc: Asai__.Range.t ->
5555+ ?init_backtrace: Asai__.Diagnostic.backtrace ->
5656+ (unit -> 'a) ->
5757+ 'a