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

runtest aliases create unintended dependency on internal libary #568

Closed
paurkedal opened this issue Mar 1, 2018 · 2 comments
Closed

runtest aliases create unintended dependency on internal libary #568

paurkedal opened this issue Mar 1, 2018 · 2 comments

Comments

@paurkedal
Copy link

While trying to fix ocaml/opam-repository#11495 I hit what I think is a bug in dune (or rather, still jbuilder 1.0+beta18). The attached file is a simplified source directory to reproduce the problem. It contains two independent libraries lib1 and lib2 each with their own tests test1 and test2, respectively. All .ml files are empty and there are now cross dependencies. I get the following error when running tests for either of them, say lib1:

$ jbuilder runtest -p lib1 --debug-dependency-path
File "jbuild", line 33, characters 1-56:
Error: Library "lib2" not found.

Hint: try: jbuilder external-lib-deps --missing -p lib1 @runtest
Dependency path:
    alias runtest
--> alias runtest
--> test1.exe
--> .merlin-exists
--> .merlin

If I interpret this right, the .merlin file gets a dependency on both libraries.

The issue can be avoided by putting the libraries and tests in separate directories. Some solutions I can think of:

  • Omit the .merlin file if -p is specified, if the option is mainly meant for opam builds and pre-release testing.
  • Only build the part of the .merlin file requested by the -p option.
  • Require that separate packages are built in separate directories, preferably adding a check to dune to enforce it, or at least document it.

dune-cross-deps.tar.gz

ghost pushed a commit that referenced this issue Mar 1, 2018
ghost pushed a commit that referenced this issue Mar 1, 2018
@ghost
Copy link

ghost commented Mar 1, 2018

Thanks for the reproduction case. This is indeed a bug, I changed things so that errors occurring during the generation of the .merlin file are ignored.

@paurkedal
Copy link
Author

Nice!

rgrinberg added a commit that referenced this issue Mar 2, 2018
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jul 4, 2020
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jul 6, 2020
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant