From 3f984cda2e1bf57b998712333c829c84e1fe9c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bobot?= Date: Wed, 31 Jul 2019 17:37:47 +0200 Subject: [PATCH] Fix `@all` alias should only build enabled libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2272 Signed-off-by: François Bobot --- src/gen_rules.ml | 4 +++- test/blackbox-tests/test-cases/github2272/run.t | 6 ------ test/blackbox-tests/test-cases/optional/run.t | 8 +------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 10fcc9189c7..243a109dadc 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -86,7 +86,9 @@ module Gen(P : sig val sctx : Super_context.t end) = struct | Toplevel toplevel -> Toplevel_rules.setup ~sctx ~dir ~toplevel; For_stanza.empty_none - | Library lib -> + | Library lib when + Lib.DB.available (Scope.libs scope) (Dune_file.Library.best_name lib) + -> let cctx, merlin = Lib_rules.rules lib ~sctx ~dir ~scope ~dir_contents ~expander in { For_stanza. diff --git a/test/blackbox-tests/test-cases/github2272/run.t b/test/blackbox-tests/test-cases/github2272/run.t index ed7a66e63ac..f3283ae0315 100644 --- a/test/blackbox-tests/test-cases/github2272/run.t +++ b/test/blackbox-tests/test-cases/github2272/run.t @@ -1,8 +1,2 @@ The @all alias should only build enabled libraries $ dune build @all --display short - ocamldep disabled/.foo.objs/foo.ml.d - ocamlc disabled/.foo.objs/byte/foo.{cmi,cmo,cmt} - ocamlc disabled/foo.cma - ocamlopt disabled/.foo.objs/native/foo.{cmx,o} - ocamlopt disabled/foo.{a,cmxa} - ocamlopt disabled/foo.cmxs diff --git a/test/blackbox-tests/test-cases/optional/run.t b/test/blackbox-tests/test-cases/optional/run.t index 7750d0d411b..952c54a3c00 100644 --- a/test/blackbox-tests/test-cases/optional/run.t +++ b/test/blackbox-tests/test-cases/optional/run.t @@ -4,14 +4,8 @@ Various tests for optional libraries Regression test for non-wrapped optional libraries with missing dependencies (#1281): - $ dune build + $ dune build @install Interaction between `@all` and optional libraries: $ dune build @all - File "dune", line 6, characters 12-34: - 6 | (libraries lib_that_doesn't_exist)) - ^^^^^^^^^^^^^^^^^^^^^^ - Error: Library "lib_that_doesn't_exist" not found. - Hint: try: dune external-lib-deps --missing @all - [1]