From 720384b5f135ad008ae6abf68079d203f58a28dc Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 27 Oct 2024 03:15:57 +0000 Subject: command-line-tool: Implement WorkReuse. * ravanan/command-line-tool.scm (%command-line-tool-supported-requirements): Add WorkReuse. * ravanan/command-line-tool.scm (build-command-line-tool-script): Implement WorkReuse. --- ravanan/command-line-tool.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index 250f5b2..da585d8 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -73,7 +73,8 @@ "InlineJavascriptRequirement" "InitialWorkDirRequirement" "ResourceRequirement" - "SoftwareRequirement")) + "SoftwareRequirement" + "WorkReuse")) (define (command-line-tool-supported-requirements batch-system) (cond @@ -722,13 +723,23 @@ named @var{name} with @var{inputs} using tools from Guix manifest in (check-requirements requirements batch-system command-line-tool-supported-requirements - %command-line-tool-supported-requirements)) + %command-line-tool-supported-requirements) + ;; Error out if WorkReuse is disabled. + (maybe-let* ((work-reuse (find-requirement requirements "WorkReuse"))) + (and (not (coerce-type (assoc-ref* work-reuse "enableReuse") + 'boolean)) + (user-error "Disabling WorkReuse is not supported. ravanan's strong caching using Guix makes it unnecessary.")))) (maybe-let* ((hints (maybe-assoc-ref (just cwl) "hints"))) (check-requirements hints batch-system command-line-tool-supported-requirements %command-line-tool-supported-requirements - #t)) + #t) + ;; Warn if WorkReuse is disabled. + (maybe-let* ((work-reuse (find-requirement hints "WorkReuse"))) + (and (not (coerce-type (assoc-ref* work-reuse "enableReuse") + 'boolean)) + (warning "Ignoring disable of WorkReuse. ravanan's strong caching using Guix makes it unnecessary.")))) ;; Copy input files and update corresponding input objects. (build-gexp-script name (let* ((requirements (inherit-requirements (or (assoc-ref cwl "requirements") -- cgit v1.2.3