Skip to content

Commit d873510

Browse files
author
Peter Amstutz
committed
Use file content literals for InitialWorkDir.
1 parent 3fb9340 commit d873510

File tree

7 files changed

+52
-18
lines changed

7 files changed

+52
-18
lines changed

draft-4/CommandLineTool.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,23 @@ $graph:
630630
IRI such as an [RRID](http://www.identifiers.org/rrid/SCR_001156).
631631
Example: `http://identifiers.org/rrid/RRID:SCR_001156`
632632
633+
- name: FileExt
634+
type: record
635+
extends: File
636+
fields:
637+
writable:
638+
type: boolean?
639+
doc: If true, the File must be writable.
640+
641+
- name: DirectoryExt
642+
type: record
643+
extends: Directory
644+
fields:
645+
writable:
646+
type: boolean?
647+
doc: If true, the Directory must be writable.
648+
649+
633650
- name: InitialWorkDirRequirement
634651
type: record
635652
extends: ProcessRequirement
@@ -641,13 +658,11 @@ $graph:
641658
- name: listing
642659
type:
643660
- type: array
644-
items: [File, Directory]
661+
items: [FileExt, DirectoryExt, string, Expression]
645662
- string
646663
- Expression
647664
jsonldPredicate:
648665
_id: "cwl:listing"
649-
mapSubject: entryname
650-
mapPredicate: entry
651666
doc: |
652667
The list of files or subdirectories that must be placed in the
653668
designated output directory prior to executing the command line tool.

draft-4/Process.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ $graph:
6565
_type: "@vocab"
6666
doc: Must be `File` to indicate this object describes a file.
6767
- name: location
68-
type: string
68+
type: [string, Expression]
6969
doc: |
7070
A URI that identifies the file resource. This may be a relative
7171
reference, in which case it must be resolved using the base URI of the
@@ -82,6 +82,8 @@ $graph:
8282
If the `path` field is provided but the `location` field is not, an
8383
implementation may assign the value of the `path` field to `location`,
8484
then follow the rules above.
85+
86+
Must be evaluated as an expression only when appearing in InitialWorkDirRequirement.
8587
jsonldPredicate:
8688
_id: "@id"
8789
_type: "@id"
@@ -102,7 +104,7 @@ $graph:
102104
"_id": "cwl:path"
103105
"_type": "@id"
104106
- name: basename
105-
type: string
107+
type: [string, Expression]
106108
doc: |
107109
The base name of the file, that is, the name of the file without any
108110
leading directory path. The base name must not contain a slash `/`.
@@ -115,6 +117,8 @@ $graph:
115117
When this file is made available to a CommandLineTool, it must be named
116118
with `basename`, i.e. the final component of the `path` field must match
117119
`basename`.
120+
121+
Must be evaluated as an expression only when appearing in InitialWorkDirRequirement.
118122
- name: dirname
119123
type: string?
120124
doc: |
@@ -189,9 +193,19 @@ $graph:
189193
root of the document. If no ontologies are specified in `$schema`, the
190194
runtime may perform exact file format matches.
191195
- name: contents
192-
type: string?
196+
type: ["null", string, Expression]
193197
doc: |
194-
content
198+
File contents literal. Maximum of 64 KiB.
199+
200+
If neither `location` nor `path` is provided, `contents` must be
201+
non-null. The implementation must assign a unique identifier for the
202+
`location` field. When the file is staged as input to CommandLineTool,
203+
the value of `contents` must be written to a file.
204+
205+
If `loadContents` of `Binding` is true and `location` is valid, the
206+
implementation must read up to the first 64 KiB of text from the file
207+
and place it in the "contents" field.
208+
195209
196210
- name: Directory
197211
type: record
@@ -247,6 +261,8 @@ $graph:
247261
- "null"
248262
- type: array
249263
items: [File, Directory]
264+
- string
265+
- Expression
250266
doc: |
251267
List of files or subdirectories contained in this directory. The name
252268
of each file or subdirectory is determined by the `basename` field of
@@ -255,6 +271,8 @@ $graph:
255271
`Directory` object share the same `basename`, this must be treated as
256272
equivalent to a single subdirectory with the listings recursively
257273
merged.
274+
275+
Must be evaluated as an expression only when appearing in InitialWorkDirRequirement.
258276
jsonldPredicate:
259277
_id: "cwl:listing"
260278
mapSubject: entryname

draft-4/draft-4/dir4-job.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ inf:
44
secondaryFiles:
55
- class: File
66
location: index.py
7-
- entryname: xtestdir
8-
entry:
9-
class: Directory
10-
location: testdir
7+
- class: Directory
8+
basename: xtestdir
9+
location: testdir

draft-4/draft-4/rename.cwl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ baseCommand: "true"
44
requirements:
55
InitialWorkDirRequirement:
66
listing:
7-
- entryname: $(inputs.newname)
8-
entry: $(inputs.srcfile)
7+
- class: File
8+
basename: $(inputs.newname)
9+
location: $(inputs.srcfile.location)
910
inputs:
1011
srcfile: File
1112
newname: string

draft-4/draft-4/search.cwl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $graph:
99
requirements:
1010
- class: InitialWorkDirRequirement
1111
listing:
12-
input.txt: $(inputs.file)
12+
- $(inputs.file)
1313
- class: InlineJavascriptRequirement
1414

1515
inputs:

draft-4/draft-4/stagefile.cwl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ cwlVersion: draft-4.dev3
33
requirements:
44
InitialWorkDirRequirement:
55
listing:
6-
- entryname: $(inputs.infile.basename)
7-
entry: $(inputs.infile)
6+
- class: File
7+
location: $(inputs.infile.location)
88
writable: true
99
inputs:
1010
infile: File

draft-4/draft-4/template-tool.cwl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ requirements:
1010
- "var t = function(s) { return _.template(s)({'inputs': inputs}); };"
1111
- class: InitialWorkDirRequirement
1212
listing:
13-
foo.txt: >
14-
$(t("The file is <%= inputs.file1.path.split('/').slice(-1)[0] %>\n"))
13+
- class: File
14+
basename: foo.txt
15+
contents: $(t("The file is <%= inputs.file1.path.split('/').slice(-1)[0] %>\n"))
1516
inputs:
1617
- id: file1
1718
type: File

0 commit comments

Comments
 (0)