Skip to content

Commit

Permalink
take exec into account in Dep.of_block
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Mar 5, 2024
1 parent c12ff69 commit 2e127be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 7 additions & 0 deletions lib/block.ml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ let non_det t =
| Include _ | Raw _ -> None

let skip t = t.skip

let exec t =
match t.value with
| Include { file_kind = Fk_ocaml { exec; _ }; _ } -> exec
| Include _ | Raw _ -> false
| _ -> true

let set_variables t = t.set_variables
let unset_variables t = t.unset_variables
let value t = t.value
Expand Down
3 changes: 3 additions & 0 deletions lib/block.mli
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ val unset_variables : t -> string list
val skip : t -> bool
(** [skip t] is true iff [skip] is in the labels of [t]. *)

val exec : t -> bool
(** [exec t] is true iff [exec] is in the labels of [t]. *)

val value : t -> value
(** [value t] is [t]'s value. *)

Expand Down
15 changes: 8 additions & 7 deletions lib/dep.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

type t = File of string | Dir of string

let of_block block =
let of_block b =
let open Block in
match (directory block, file block, skip block) with
| Some d, Some f, false -> Some (File (Filename.concat d f))
| Some d, None, false -> Some (Dir d)
| None, Some f, false -> Some (File f)
| None, None, false -> None
| _, _, true -> None
let block b = (not (skip b)) || exec b in
match (directory b, file b, block b) with
| Some d, Some f, true -> Some (File (Filename.concat d f))
| Some d, None, true -> Some (Dir d)
| None, Some f, true -> Some (File f)
| None, None, true -> None
| _, _, false -> None

let of_lines =
let open Document in
Expand Down

0 comments on commit 2e127be

Please sign in to comment.