Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Aug 5, 2020
1 parent fb2f49b commit ad82f2a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/dune/opam_create.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ let package_fields
List.concat fields

let dune_name = Package.Name.of_string "dune"

let odoc_name = Package.Name.of_string "odoc"

let insert_dune_dep depends dune_version =
Expand Down Expand Up @@ -131,8 +132,12 @@ let insert_dune_dep depends dune_version =
in
loop [] depends

let rec already_requires_odoc : Package.Dependency.Constraint.t -> bool = function
| Bvar (Var "with-doc" | Var "build" | Var "post") | Uop _ | Bop _ -> true
let rec already_requires_odoc : Package.Dependency.Constraint.t -> bool =
function
| Bvar (Var "with-doc" | Var "build" | Var "post")
| Uop _
| Bop _ ->
true
| Bvar _ -> false
| And l -> List.for_all ~f:already_requires_odoc l
| Or l -> List.exists ~f:already_requires_odoc l
Expand All @@ -145,8 +150,10 @@ let insert_odoc_dep depends =
let rec loop acc = function
| [] -> List.rev (odoc_dep :: acc)
| (dep : Package.Dependency.t) :: rest ->
if Package.Name.equal dep.name odoc_name &&
Option.forall ~f:already_requires_odoc dep.constraint_ then
if
Package.Name.equal dep.name odoc_name
&& Option.forall ~f:already_requires_odoc dep.constraint_
then
(* Stop now as odoc will be required anyway *)
List.rev_append (dep :: acc) rest
else
Expand Down

0 comments on commit ad82f2a

Please sign in to comment.