From da2366e14478ffe63447f82d152d17e0c8c7a4ad Mon Sep 17 00:00:00 2001 From: Marek Kubica Date: Wed, 28 Aug 2024 11:03:20 +0200 Subject: [PATCH] Set the caching property on `make` Signed-off-by: Marek Kubica --- src/dune_engine/action.ml | 1 - src/dune_engine/action.mli | 3 --- src/dune_rules/fetch_rules.ml | 12 +++++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/dune_engine/action.ml b/src/dune_engine/action.ml index 8f48b8d7fac1..dd06e73575ff 100644 --- a/src/dune_engine/action.ml +++ b/src/dune_engine/action.ml @@ -351,6 +351,5 @@ module Full = struct { t with can_go_in_shared_cache = t.can_go_in_shared_cache && b } ;; - let allowed_in_shared_cache t = { t with can_go_in_shared_cache = true } let add_sandbox s t = { t with sandbox = Sandbox_config.inter t.sandbox s } end diff --git a/src/dune_engine/action.mli b/src/dune_engine/action.mli index 5632eb3a54c7..ddd77b02e0ce 100644 --- a/src/dune_engine/action.mli +++ b/src/dune_engine/action.mli @@ -172,8 +172,5 @@ module Full : sig val add_sandbox : Sandbox_config.t -> t -> t val add_can_go_in_shared_cache : bool -> t -> t - (** Marks action as safe to be cached *) - val allowed_in_shared_cache : t -> t - include Monoid with type t := t end diff --git a/src/dune_rules/fetch_rules.ml b/src/dune_rules/fetch_rules.ml index e6f4b64da3d8..39552c7a5c1f 100644 --- a/src/dune_rules/fetch_rules.ml +++ b/src/dune_rules/fetch_rules.ml @@ -181,10 +181,10 @@ let find_checksum, find_url = ;; let gen_rules_for_checksum_or_url (loc_url, (url : OpamUrl.t)) checksum = - let checksum_or_url, allowed_in_shared_cache = + let checksum_or_url, can_go_in_shared_cache = match checksum with - | Some (_, checksum) -> `Checksum checksum, Action.Full.allowed_in_shared_cache - | None -> `Url url, Fun.id + | Some (_, checksum) -> `Checksum checksum, Some true + | None -> `Url url, None in let directory_targets = let target_dir = make_target ~kind:`Directory checksum_or_url in @@ -205,8 +205,7 @@ let gen_rules_for_checksum_or_url (loc_url, (url : OpamUrl.t)) checksum = let make_target = make_target checksum_or_url in let action ~target ~kind = action ~url:(loc_url, url) ~checksum ~target ~kind - |> Action.Full.make - |> allowed_in_shared_cache + |> Action.Full.make ?can_go_in_shared_cache |> Action_builder.return |> Action_builder.with_no_targets in @@ -327,8 +326,7 @@ let fetch ~target kind (source : Source.t) = .fetch context. This would just add pointless additional overhead. *) action ~url:source.url ~checksum:source.checksum ~target ~kind in - Action.Full.make action - |> Action.Full.allowed_in_shared_cache + Action.Full.make ~can_go_in_shared_cache:true action |> Action_builder.With_targets.return |> Action_builder.With_targets.add_directories ~directory_targets:[ target ] ;;