Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: demonstrate a dependency cycle between modules field and rule #10370

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions test/blackbox-tests/test-cases/lib-available-dynamic-modules.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Demonstrate a dependency cycle between library modules field and a rule that
generates them dynamically in the same directory

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

$ mkdir gen
$ cat > gen/dune << EOF
> (executable
> (name gen)
> (libraries y))
> (rule
> (with-stdout-to dyn_modules (run ./gen.exe)))
> EOF
$ cat > gen/gen.ml <<EOF
> let () =
> Format.eprintf "generating. %s from 'y'" Y.x;
> Format.printf "foo"
> EOF
$ touch foo.ml
$ cat > dune << EOF
> (library
> (name x)
> (modules %{read:gen/dyn_modules}))
> (library
> (name y)
> (modules y))
> EOF
$ cat > y.ml <<EOF
> let x = "hello"
> EOF
$ dune build ./gen/dyn_modules
Error: Dependency cycle between:
_build/default/gen/dyn_modules
-> %{read:gen/dyn_modules} at dune:3
-> (modules) field at dune:1
-> _build/default/gen/.merlin-conf/exe-gen
-> _build/default/gen/gen.exe
-> _build/default/gen/dyn_modules
[1]