Skip to content

Commit

Permalink
Fix @all alias should only build enabled libraries
Browse files Browse the repository at this point in the history
Fixes #2272

Signed-off-by: François Bobot <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
bobot authored and rgrinberg committed Oct 11, 2019
1 parent e95ddd4 commit b09dcdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
12 changes: 7 additions & 5 deletions src/dune/gen_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ->
Expand Down
6 changes: 0 additions & 6 deletions test/blackbox-tests/test-cases/github2272/run.t
Original file line number Diff line number Diff line change
@@ -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
6 changes: 0 additions & 6 deletions test/blackbox-tests/test-cases/optional/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit b09dcdf

Please sign in to comment.