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

Reproduce %{lib-private} bug #3777

Merged
merged 1 commit into from
Sep 9, 2020
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.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,44 @@ TODO: Fix %{libexec} and %{libexec-private} variables and test them.
project. The current project's name is "test-lib", but the reference is to
"another-lib".
[1]

----------------------------------------------------------------------------------
* lib-private with --only-packages
In this test, two packages are defined in the same project, but we may not
access the artifacts through %{lib-private}

$ mkdir lib-private-only-packages
$ cd lib-private-only-packages
$ mkdir lib1 lib2
$ cat >dune-project <<EOF
> (lang dune 2.8)
> (name lib-private-test)
> (package (name public_lib1))
> (package (name public_lib2))
> EOF
$ cat >lib1/dune <<EOF
> (library
> (name lib1)
> (public_name public_lib1))
> EOF
$ touch lib1/lib1.ml
$ cat >lib2/dune <<EOF
> (library
> (name lib2)
> (public_name public_lib2))
> (rule
> (with-stdout-to lib2.ml (echo "let _ = {|%{lib-private:lib1:lib1.ml}|}")))
> EOF

The build works in development:
$ dune build @install

But will fail when we release it, as it will need to run with -p:
$ dune build @install --only-packages public_lib2
File "lib2/dune", line 5, characters 44-69:
5 | (with-stdout-to lib2.ml (echo "let _ = {|%{lib-private:lib1:lib1.ml}|}")))
^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Library "lib1" not found.
Hint: try:
dune external-lib-deps --missing --only-packages public_lib2 @install
[1]