From 2e127bed883237e48b1ebe2aaa27cdf7090559e2 Mon Sep 17 00:00:00 2001 From: Guillaume Petiot Date: Tue, 5 Mar 2024 13:27:07 +0000 Subject: [PATCH] take exec into account in Dep.of_block --- lib/block.ml | 7 +++++++ lib/block.mli | 3 +++ lib/dep.ml | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/block.ml b/lib/block.ml index 92eb227b9..c7755715f 100644 --- a/lib/block.ml +++ b/lib/block.ml @@ -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 diff --git a/lib/block.mli b/lib/block.mli index 8b33feb42..fecb4b614 100644 --- a/lib/block.mli +++ b/lib/block.mli @@ -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. *) diff --git a/lib/dep.ml b/lib/dep.ml index 0f5b06a37..90762854e 100644 --- a/lib/dep.ml +++ b/lib/dep.ml @@ -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