forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ml-sources): check that a library is available before tracking it
Since ocaml#10307, dune started allowing libraries to share the same name. Thus, checking `enabled_if` isn't enough for libraries; dune now needs to check whether the library is available before tracking it in ml_sources Signed-off-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
c6a0a69
commit e194818
Showing
2 changed files
with
72 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/blackbox-tests/test-cases/lib-collision/lib-collision-private-optional.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Private libraries using the same library name, in the same context, defined in | ||
the same folder. One of them is unavailable because it's `(optional)` and a | ||
dependency is missing. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> EOF | ||
|
||
$ cat > dune << EOF | ||
> (library | ||
> (name foo) | ||
> (libraries xxx) | ||
> (optional)) | ||
> (library | ||
> (name foo)) | ||
> EOF | ||
$ cat > foo.ml << EOF | ||
> let x = "hello" | ||
> EOF | ||
|
||
Without any consumers of the libraries | ||
|
||
$ dune build | ||
|
||
With some consumer of the library | ||
|
||
$ cat > dune << EOF | ||
> (library | ||
> (name foo) | ||
> (modules foo) | ||
> (libraries xxx) | ||
> (optional)) | ||
> (library | ||
> (modules foo) | ||
> (name foo)) | ||
> (executable | ||
> (name main) | ||
> (modules main) | ||
> (libraries foo)) | ||
> EOF | ||
|
||
$ cat > main.ml <<EOF | ||
> let () = print_endline Foo.x | ||
> EOF | ||
|
||
$ dune build |