Merge pull request #574 from diml/workaround-broken-builtins
Add a simple workaround for #563
This commit is contained in:
commit
09aa2cd1cf
|
@ -3,6 +3,10 @@ next
|
||||||
|
|
||||||
- Ignore errors during the generation of the .merlin (#569, fixes #568 and #51)
|
- Ignore errors during the generation of the .merlin (#569, fixes #568 and #51)
|
||||||
|
|
||||||
|
- Add a workaround for when a library normally installed by the
|
||||||
|
compiler is not installed but still has a META file (#574, fixes
|
||||||
|
#563)
|
||||||
|
|
||||||
1.0+beta18 (25/02/2018)
|
1.0+beta18 (25/02/2018)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
|
@ -189,15 +189,10 @@ let parse_package t ~meta_file ~name ~parent_dir ~vars =
|
||||||
Path.relative t.stdlib_dir
|
Path.relative t.stdlib_dir
|
||||||
(String.sub pkg_dir ~pos:1 ~len:(String.length pkg_dir - 1))
|
(String.sub pkg_dir ~pos:1 ~len:(String.length pkg_dir - 1))
|
||||||
else if Filename.is_relative pkg_dir then
|
else if Filename.is_relative pkg_dir then
|
||||||
Path.relative parent_dir pkg_dir
|
Path.relative parent_dir pkg_dir
|
||||||
else
|
else
|
||||||
Path.absolute pkg_dir
|
Path.absolute pkg_dir
|
||||||
in
|
in
|
||||||
let exists_if = Vars.get_words vars "exists_if" Ps.empty in
|
|
||||||
let exists =
|
|
||||||
List.for_all exists_if ~f:(fun fn ->
|
|
||||||
Path.exists (Path.relative dir fn))
|
|
||||||
in
|
|
||||||
let pkg =
|
let pkg =
|
||||||
{ Package.
|
{ Package.
|
||||||
meta_file
|
meta_file
|
||||||
|
@ -206,6 +201,28 @@ let parse_package t ~meta_file ~name ~parent_dir ~vars =
|
||||||
; vars
|
; vars
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
|
let exists_if = Vars.get_words vars "exists_if" Ps.empty in
|
||||||
|
let exists =
|
||||||
|
match exists_if with
|
||||||
|
| _ :: _ ->
|
||||||
|
List.for_all exists_if ~f:(fun fn ->
|
||||||
|
Path.exists (Path.relative dir fn))
|
||||||
|
| [] ->
|
||||||
|
if not (String_map.mem t.builtins (root_package_name name)) then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
(* The META files for installed packages are sometimes broken,
|
||||||
|
i.e. META files for libraries that were not installed by
|
||||||
|
the compiler are still present:
|
||||||
|
|
||||||
|
https://github.com/ocaml/dune/issues/563
|
||||||
|
|
||||||
|
To workaround this problem, for builtin packages we check
|
||||||
|
that at least one of the archive is present. *)
|
||||||
|
match Package.archives pkg with
|
||||||
|
| { byte = []; native = [] } -> true
|
||||||
|
| { byte; native } -> List.exists (byte @ native) ~f:Path.exists
|
||||||
|
in
|
||||||
let res =
|
let res =
|
||||||
if exists then
|
if exists then
|
||||||
Ok pkg
|
Ok pkg
|
||||||
|
|
Loading…
Reference in New Issue