Skip to content

Commit c04fef6

Browse files
committed
Load the workspace config in two stages
So that we don't fail immediately if the context definition is wrong for instnace. Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
1 parent 2f477a4 commit c04fef6

File tree

6 files changed

+228
-123
lines changed

6 files changed

+228
-123
lines changed

bin/common.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ let set_common ?log_file c =
156156
can interpret errors in the workspace file. *)
157157
print_entering_message c;
158158
Dune_rules.Workspace.Clflags.set c.workspace_config;
159-
let workspace =
159+
let config =
160160
(* Here we make the assumption that this computation doesn't yield. *)
161161
Fiber.run
162-
(Memo.Build.run (Dune_rules.Workspace.workspace ()))
162+
(Memo.Build.run (Dune_rules.Workspace.workspace_config ()))
163163
~iter:(fun () -> assert false)
164164
in
165165
let config =
166-
Dune_config.adapt_display workspace.config
166+
Dune_config.adapt_display config
167167
~output_is_a_tty:(Lazy.force Ansi_color.stderr_supports_color)
168168
in
169169
Dune_config.init config;

src/dune_lang/decoder.ml

+4
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ let capture ctx state =
264264
let f t = result ctx (t ctx state) in
265265
(f, [])
266266

267+
let lazy_ t =
268+
let+ f = capture in
269+
lazy (f t)
270+
267271
let end_of_list (Values (loc, cstr, _)) =
268272
match cstr with
269273
| None ->

src/dune_lang/decoder.mli

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ val repeat1 : 'a t -> 'a list t
124124
(** Capture the rest of the input for later parsing *)
125125
val capture : ('a t -> 'a) t
126126

127+
(** Delay the parsing of the rest of the input *)
128+
val lazy_ : 'a t -> 'a Lazy.t t
129+
127130
(** [enter t] expect the next element of the input to be a list and parse its
128131
contents with [t]. *)
129132
val enter : 'a t -> 'a t

0 commit comments

Comments
 (0)