about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-11-29 02:20:00 +0000
committerArun Isaac2025-11-29 02:20:00 +0000
commit524989772d8a74c8245b089135bcf24472ddc9ad (patch)
tree04b673d414b7e9b6615378a68f84f1afcf7e1f4a
parent880bd67ce47a7151fb75de35b7523a9473d92a0c (diff)
downloadravanan-524989772d8a74c8245b089135bcf24472ddc9ad.tar.gz
ravanan-524989772d8a74c8245b089135bcf24472ddc9ad.tar.lz
ravanan-524989772d8a74c8245b089135bcf24472ddc9ad.zip
command-line-tool: Remove unused build-command function.
The build-command function was moved to (ravanan work
command-line-tool), but somehow an unused copy remained in (ravanan
command-line-tool).
-rw-r--r--ravanan/command-line-tool.scm108
1 files changed, 0 insertions, 108 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index e8b7eb8..c1cd53e 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -177,114 +177,6 @@ keys @code{input}, @code{self} and @code{runtime}."
       ;; Not a javascript expression, but some other JSON tree. Return it as is.
       expression))
 
-(define (build-command cwl inputs)
-  "Return a list of @code{<command-line-binding>} objects for the
-@code{CommandLineTool} class workflow @var{cwl} and @var{inputs}. The
-@code{value} field of the returned @code{<command-line-binding>} objects may be
-strings or G-expressions. The G-expressions may reference @var{inputs} and
-@var{runtime} variables that must be defined in the context in which the
-G-expressions are inserted."
-  (define (argument->command-line-binding i argument)
-    (command-line-binding (cond
-                           ((assoc-ref argument "position")
-                            => string->number)
-                           (else i))
-                          (maybe-assoc-ref (just argument) "prefix")
-                          'string
-                          #~(value->string
-                             #$(coerce-expression
-                                (assoc-ref* argument "valueFrom")))
-                          %nothing))
-
-  (define (collect-bindings ids+inputs+types+bindings)
-    (append-map id+input+type-tree+binding->command-line-binding
-                ids+inputs+types+bindings))
-  
-  (define id+input+type-tree+binding->command-line-binding
-    (match-lambda
-      ;; We stretch the idea of an input id, by making it an address that
-      ;; identifies the exact location of a value in a tree that possibly
-      ;; contains array types. For example, '("foo") identifies the input "foo";
-      ;; '("foo" 1) identifies the 1th element of the array input "foo"; '("foo"
-      ;; 37 1) identifies the 1th element of the 37th element of the array input
-      ;; "foo"; etc.
-      ((id input type-tree binding)
-       ;; Check type.
-       (let* ((type (formal-parameter-type type-tree))
-              (matched-type (match-type input type)))
-         (unless matched-type
-           (error input "Type mismatch" input type))
-         (let ((position
-                (from-maybe
-                 (maybe-let* ((position (maybe-assoc-ref binding "position")))
-                   (just (string->number position)))
-                 ;; FIXME: Why a default value of 0?
-                 0))
-               (prefix (maybe-assoc-ref binding "prefix")))
-           (cond
-            ;; Recurse over array types.
-            ;; TODO: Implement record and enum types.
-            ((cwl-array-type? matched-type)
-             (list (command-line-binding
-                    position
-                    prefix
-                    matched-type
-                    (append-map (lambda (i input)
-                                  (id+input+type-tree+binding->command-line-binding
-                                   (list (append id (list i))
-                                         input
-                                         (assoc-ref type-tree "items")
-                                         (maybe-assoc-ref (just type-tree)
-                                                          "inputBinding"))))
-                                (iota (vector-length input))
-                                (vector->list input))
-                    (maybe-assoc-ref binding "itemSeparator"))))
-            (else
-             (list (command-line-binding position
-                                         prefix
-                                         matched-type
-                                         ;; We defer access of input values to
-                                         ;; runtime when inputs have been fully
-                                         ;; resolved, staging is complete, etc.
-                                         #~(apply json-ref inputs '#$id)
-                                         %nothing)))))))))
-  
-  ;; For details of this algorithm, see ยง4.1 Input binding of the CWL
-  ;; 1.2 CommandLineTool specification:
-  ;; https://www.commonwl.org/v1.2/CommandLineTool.html#Input_binding
-  (append
-   ;; Insert elements from baseCommand.
-   (vector->list (or (assoc-ref cwl "baseCommand")
-                     (vector)))
-   (sort
-    (append
-     ;; Collect CommandLineBinding objects from arguments; assign a sorting key.
-     (vector->list
-      (vector-map-indexed argument->command-line-binding
-                          (or (assoc-ref cwl "arguments")
-                              #())))
-     ;; Collect CommandLineBinding objects from the inputs schema; assign a
-     ;; sorting key.
-     (collect-bindings
-      (filter-map (lambda (formal-input)
-                    ;; Exclude formal inputs without an inputBinding.
-                    (and (assoc "inputBinding" formal-input)
-                         (let ((id (assoc-ref formal-input "id")))
-                           (list (list id)
-                                 (or (assoc-ref inputs id)
-                                     (assoc-ref formal-input "default")
-                                     'null)
-                                 (or (assoc-ref formal-input "type")
-                                     (user-error "Type of input ~a not specified"
-                                                 id))
-                                 (maybe-assoc-ref (just formal-input)
-                                                  "inputBinding")))))
-                  (vector->list (assoc-ref cwl "inputs")))))
-    ;; Sort elements using the assigned sorting keys.
-    (lambda (binding1 binding2)
-      (< (command-line-binding-position binding1)
-         (command-line-binding-position binding2))))))
-
 (define* (build-gexp-script name exp)
   "Build script named @var{name} using G-expression @var{exp}. Return the path to
 the built script as a monadic value."