Skip to content

Commit

Permalink
test(pkg): repro 10839 (#10980)
Browse files Browse the repository at this point in the history
OCaml syntax doesn't work with package management

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg authored Oct 1, 2024
1 parent 63fac22 commit 1b0c7d9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dune_rules/dune_file.ml
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,14 @@ module Eval = struct
let set_dynamic_stanzas = set_dynamic_stanzas ~context in
let+ ocaml_syntax =
Memo.parallel_map ocaml_syntax ~f:(fun script ->
let+ dune_file, dynamic_includes = Script.eval_one ~context script in
let+ dune_file, dynamic_includes =
Memo.push_stack_frame
~human_readable_description:(fun () ->
Pp.textf
"- evaluating dune file %S in OCaml syntax"
(Path.Source.to_string script.file))
(fun () -> Script.eval_one ~context script)
in
set_dynamic_stanzas dune_file ~eval:script.eval ~dynamic_includes)
in
let dune_syntax =
Expand Down
39 changes: 39 additions & 0 deletions test/blackbox-tests/test-cases/pkg/ocaml-syntax-gh10839.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Reproduce #10839.

Dune file in OCaml syntax and a files directory should work

$ . ./helpers.sh

$ make_lockdir

$ make_lockpkg base-bytes <<EOF
> (version base)
>
> (depends ocamlfind)
> EOF

$ make_lockpkg ocamlfind <<EOF
> (version 1)
> EOF

$ cat >dune-project <<EOF
> (lang dune 3.16)
> EOF

$ cat >dune <<EOF
> (* -*- tuareg -*- *)
> let () = Jbuild_plugin.V1.send ""
> EOF

$ dune build

$ mkdir dune.lock/ocamlfind.files
$ touch dune.lock/ocamlfind.files/foo.patch

$ dune build
Error: Dependency cycle between:
- evaluating dune file "dune" in OCaml syntax
-> _build/_private/default/.pkg/ocamlfind/target/cookie
-> - package base-bytes
-> - evaluating dune file "dune" in OCaml syntax
[1]

0 comments on commit 1b0c7d9

Please sign in to comment.