-
Notifications
You must be signed in to change notification settings - Fork 414
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
Allow dependencies for executables #3499
Comments
#3104 also gives examples where you want all the ressource directories to be up-to-date. |
If dune doesn't re-run the test when the executable changes, that is definitely a bug |
This can be cleaned up once ocaml/dune#3499 is implemented. It should help running entirely separate solver services in future, and also fixes a bug where the unit-tests might test against an old version of the solver.
This can be cleaned up once ocaml/dune#3499 is implemented. It should help running entirely separate solver services in future, and also fixes a bug where the unit-tests might test against an old version of the solver.
This can be cleaned up once ocaml/dune#3499 is implemented. It should help running entirely separate solver services in future, and also fixes a bug where the unit-tests might test against an old version of the solver.
This can be cleaned up once ocaml/dune#3499 is implemented. It should help running entirely separate solver services in future, and also fixes a bug where the unit-tests might test against an old version of the solver.
Dune has no way currently to specify runtime dependencies between binaries (see ocaml/dune#3499). With vendored mdx this causes a problem because we want to run ocaml-mdx, but that depends upon ocaml-mdx-test, which may not have been built by the time it gets execd. Instead, we tell dune to execute ocaml-mdx-test directly. Signed-off-by: Jon Ludlam <[email protected]>
Dune has no way currently to specify runtime dependencies between binaries (see ocaml/dune#3499). With vendored mdx this causes a problem because we want to run ocaml-mdx, but that depends upon ocaml-mdx-test, which may not have been built by the time it gets execd. Instead, we tell dune to execute ocaml-mdx-test directly. Signed-off-by: Jon Ludlam <[email protected]>
I wonder if this is related to the alias expansion bug @aalekseyev and @snowleopard fixed recently |
It is. So there were two issues:
the first fix feels like something we should backport in the 2.x branch. The second I'm less sure about because there is a performance degradation we should look more into before Dune 3.0. |
This case is a hack to make dependency on an executable. It's trying to copy in another name before to install it. OCaml-CI raised this issue which can be found here `https://github.com/ocaml/dune/issues/3499` This commit try solve the case but not perfect because to get the rules, we are parsing the dune source and there's some limitation on that, like dune variables.
This case is a hack to make dependency on an executable. It's trying to copy in another name before to install it. OCaml-CI raised this issue which can be found here `https://github.com/ocaml/dune/issues/3499` This commit try solve the case but not perfect because to get the rules, we are parsing the dune source and there's some limitation on that, like dune variables.
This case is a hack to make dependency on an executable. It's trying to copy in another name before to install it. OCaml-CI raised this issue which can be found here `https://github.com/ocaml/dune/issues/3499` This commit try solve the case but not perfect because to get the rules, we are parsing the dune source and there's some limitation on that, like dune variables.
For the record, I have been using libraries are "poor man deps" for this kind of case with some success. It's clunky,... but it helps workaround the problem until there is a better solution. E.g.: (executable
(name main)
(modules main)
(libraries stage2_hook unix))
(executable
(public_name stage2)
(modules stage2))
(library
(name stage2_hook)
(modules stage2_hook))
;;; Dummy file just to be able to add a custom dependency to the executable
(rule
(targets stage2_hook.ml)
(deps %{bin:stage2})
(action
(with-stdout-to
%{targets}
(run echo "")))) |
What is the current best approach for this problem? I have two public executables in my Dune project, I wrote a synthetic repro case here: https://gitlab.com/gasche/dune-executable-dependencies-repro-case # start from a clean state
$ dune clean
# this run of "dune runtest" fails
$ dune runtest
sh: line 1: foo: command not found
File "test/bar.expected", line 1, characters 0-0:
diff --git 1/_build/default/test/bar.expected 2/_build/default/test/bar.out
index 31f77a6..e69de29 100644
--- 1/_build/default/test/bar.expected
+++ 2/_build/default/test/bar.out
@@ -1 +0,0 @@
-Foo !
# dune build now also fails
$ dune build
sh: line 1: foo: command not found
File "test/bar.expected", line 1, characters 0-0:
diff --git 1/_build/default/test/bar.expected 2/_build/default/test/bar.out
index 31f77a6..e69de29 100644
--- 1/_build/default/test/bar.expected
+++ 2/_build/default/test/bar.out
@@ -1 +0,0 @@
-Foo !
# but a second run (different ordering) succeeds
$ dune build
# and now the test passes
$ dune runtest |
I just pushed a fix suggested by @nojb, which is to use |
Desired Behavior
Dune should provide a way to say that an executable depends on another build target (at runtime). Without this, running a program with
dune exec
may run with a stale build of the dependency (or fail completely).Example
main.ml:
stage2.ml:
dune
Results:
Real projects where this is a problem:
dune exec
, I may be testing the old version of the solver.dune exec -- 0install
, but this doesn't ensure that the GUI plugin is up-to-date.The text was updated successfully, but these errors were encountered: