Skip to content
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
66 changes: 66 additions & 0 deletions test/blackbox-tests/test-cases/alias/alias-multiple.t
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,69 @@ A similar test with a rule that produces a target
$ dune clean
$ dune build @b @c
I have run

Rules with no targets can have surprising behavior.

A when a target-less rule is attached to several aliases, the first listed
alias is always built.

Here, building [b] pulls in [a].
$ cat > dune << EOF
> (rule
> (aliases a b)
> (action (echo "a and b\n")))
> (rule
> (alias a)
> (action (echo "just a\n")))
> (rule
> (alias b)
> (action (echo "just b\n")))
> EOF

$ dune clean
$ dune build @b
a and b
just a
just b

Building [a] does not pull in [b].
$ dune clean
$ dune build @a
a and b
just a

Duplicating an alias causes a dependency cycle.
$ cat > dune << EOF
> (rule
> (aliases a)
> (action (echo "I have run\n")))
> EOF
$ dune clean
$ dune build @a
I have run
$ cat > dune << EOF
> (rule
> (aliases a a)
> (action (echo "I have run\n")))
> EOF
$ dune build @a
Error: Dependency cycle between:
alias a in dune:1
[1]

Reordering the aliases causes the action to re-run.
$ cat > dune << EOF
> (rule
> (aliases a b)
> (action (echo "I have run\n")))
> EOF
$ dune clean
$ dune build @a @b
I have run
$ cat > dune << EOF
> (rule
> (aliases b a)
> (action (echo "I have run\n")))
> EOF
$ dune build @a @b
I have run
Loading