diff --git a/CHANGES.md b/CHANGES.md index fe7757187b6..7e59c279fbb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -150,6 +150,8 @@ successful exit codes of ``. `` is specified using the predicate language. (#2699, @nojb) +- Do not setup rules for disabled libraries (#2491, fixes #2272, @bobot) + 1.11.4 (09/10/2019) ------------------- diff --git a/src/dune/gen_rules.ml b/src/dune/gen_rules.ml index 08cbeedf83f..e0cb7c401a4 100644 --- a/src/dune/gen_rules.ml +++ b/src/dune/gen_rules.ml @@ -64,13 +64,15 @@ end = struct } let of_stanza stanza ~sctx ~src_dir ~ctx_dir ~scope ~dir_contents ~expander - ~files_to_install = + ~files_to_install = let dir = ctx_dir in match stanza with | Toplevel toplevel -> Toplevel_rules.setup ~sctx ~dir ~toplevel; 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 @@ -89,9 +91,9 @@ end = struct ; js = Some (List.concat_map exes.names ~f:(fun (_, exe) -> - List.map - [ exe ^ ".bc.js"; exe ^ ".bc.runtime.js" ] - ~f:(Path.Build.relative dir))) + List.map + [ exe ^ ".bc.js"; exe ^ ".bc.runtime.js" ] + ~f:(Path.Build.relative dir))) ; source_dirs = None } | Alias alias -> 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 0b1025aad19..952c54a3c00 100644 --- a/test/blackbox-tests/test-cases/optional/run.t +++ b/test/blackbox-tests/test-cases/optional/run.t @@ -9,9 +9,3 @@ dependencies (#1281): 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]