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

Fix #1856 #1857

Merged
merged 2 commits into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ unreleased
is used. Add `Pkg_config.query_expr` for cases when the full power of
pkg-config's querying is needed (#1842, fix #1833, @rgrinberg)

- Fix unavailable, optional implementations eagerly breaking the build (#1857,
fix #1856, @rgrinberg)

1.7.1 (13/02/2019)
------------------

Expand Down
17 changes: 12 additions & 5 deletions src/dir_contents.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ module Modules = struct
| From _, From _ ->
let name = (fst lib.name, Library.best_name lib) in
Result.ok_exn (
let open Result.O in
Lib.DB.resolve (Scope.libs scope) name >>= fun lib ->
Lib.main_module_name lib >>= fun main_module_name ->
Lib.wrapped lib >>| fun wrapped ->
(main_module_name, Option.value_exn wrapped)
match
Lib.DB.find_even_when_hidden (Scope.libs scope) (snd name)
with
| None ->
(* can't happen because this library is defined using the
current stanza *)
assert false
| Some lib ->
let open Result.O in
Lib.main_module_name lib >>= fun main_module_name ->
Lib.wrapped lib >>| fun wrapped ->
(main_module_name, Option.value_exn wrapped)
)
in
Left ( lib
Expand Down
10 changes: 10 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@
test-cases/github1811
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))

(alias
(name github1856)
(deps (package dune) (source_tree test-cases/github1856))
(action
(chdir
test-cases/github1856
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))

(alias
(name github20)
(deps (package dune) (source_tree test-cases/github20))
Expand Down Expand Up @@ -1352,6 +1360,7 @@
(alias github1560)
(alias github1616)
(alias github1811)
(alias github1856)
(alias github20)
(alias github24)
(alias github25)
Expand Down Expand Up @@ -1509,6 +1518,7 @@
(alias github1560)
(alias github1616)
(alias github1811)
(alias github1856)
(alias github20)
(alias github24)
(alias github25)
Expand Down
1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/github1856/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.7)
Empty file.
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/github1856/impl/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(library
(name foo_impl)
(public_name foo.impl)
(implements foo)
(libraries dontexist)
(optional))
Empty file.
2 changes: 2 additions & 0 deletions test/blackbox-tests/test-cases/github1856/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Optional implementation of virtual library
$ dune build @install
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/github1856/vlib/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(library
(name foo)
(public_name foo)
(virtual_modules foo))
Empty file.