@@ -92,48 +92,8 @@ tasks:
92
92
- echo "Using $KEYNAME"
93
93
` ` `
94
94
95
- # # Operating System specific tasks
96
-
97
- If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile
98
- based on the operating system.
99
-
100
- Example :
101
-
102
- Taskfile.yml :
103
-
104
- ` ` ` yaml
105
- version: '3'
106
-
107
- tasks:
108
- build:
109
- cmds:
110
- - echo "default"
111
- ` ` `
112
-
113
- Taskfile_linux.yml :
114
-
115
- ` ` ` yaml
116
- version: '3'
117
-
118
- tasks:
119
- build:
120
- cmds:
121
- - echo "linux"
122
- ` ` `
123
-
124
- Will print out `linux` and not `default`.
125
-
126
- Keep in mind that the version of the files should match. Also, when redefining
127
- a task the whole task is replaced, properties of the task are not merged.
128
-
129
- It's also possible to have an OS specific `Taskvars.yml` file, like
130
- ` Taskvars_windows.yml` , `Taskvars_linux.yml`, or `Taskvars_darwin.yml`. See the
131
- [variables section](#variables) below.
132
-
133
95
# # Including other Taskfiles
134
96
135
- > This feature is still experimental and may have bugs.
136
-
137
97
If you want to share tasks between different projects (Taskfiles), you can use
138
98
the importing mechanism to include other Taskfiles using the `includes` keyword :
139
99
@@ -150,6 +110,21 @@ namespace. So, you'd call `task docs:serve` to run the `serve` task from
150
110
` documentation/Taskfile.yml` or `task docker:build` to run the `build` task
151
111
from the `DockerTasks.yml` file.
152
112
113
+ # ## OS-specific Taskfiles
114
+
115
+ With `version : ' 2' ` , task automatically includes any ` Taskfile_{{OS}}.yml`
116
+ if it exists (for example : ` Taskfile_windows.yml` , `Taskfile_linux.yml` or
117
+ ` Taskfile_darwin.yml` ). Since this behavior was a bit too implicit, it
118
+ was removed on version 3, but you still can have a similar behavior by
119
+ explicitly importing these files :
120
+
121
+ ` ` ` yaml
122
+ version: '3'
123
+
124
+ includes:
125
+ build: ./Taskfile_{{OS}}.yml
126
+ ` ` `
127
+
153
128
# ## Directory of included Taskfile
154
129
155
130
By default, included Taskfile's tasks are ran in the current directory, even
@@ -345,8 +320,8 @@ tasks:
345
320
- public/style.css
346
321
` ` `
347
322
348
- ` sources` and `generates` can be files or file patterns. When both are given,
349
- Task will compare the checksum of the files to determine if it's
323
+ ` sources` and `generates` can be files or file patterns. When given,
324
+ Task will compare the checksum of the source files to determine if it's
350
325
necessary to run the task. If not, it will just print a message like
351
326
` Task "js" is up to date` .
352
327
You will probably want to ignore the `.task` folder in your `.gitignore` file
@@ -371,6 +346,10 @@ tasks:
371
346
372
347
> TIP: method `none` skips any validation and always run the task.
373
348
349
+ > NOTE: for the `checksum` (default) method to work, it's only necessary to
350
+ > inform the source files, but if you want to use the `timestamp` method, you
351
+ > also need to inform the generated files with `generates`.
352
+
374
353
# ## Using programmatic checks to indicate a task is up to date.
375
354
376
355
Alternatively, you can inform a sequence of tests as `status`. If no error
@@ -451,18 +430,19 @@ with any other tasks that depend on it.
451
430
452
431
` ` ` yaml
453
432
version: '3'
433
+
454
434
tasks:
455
- task_will_fail :
435
+ task-will-fail :
456
436
preconditions:
457
437
- sh: "exit 1"
458
438
459
- task_will_also_fail :
439
+ task-will-also-fail :
460
440
deps:
461
- - task_will_fail
441
+ - task-will-fail
462
442
463
- task_will_still_fail :
443
+ task-will-still-fail :
464
444
cmds:
465
- - task: task_will_fail
445
+ - task: task-will-fail
466
446
- echo "I will not run"
467
447
` ` `
468
448
@@ -520,14 +500,6 @@ tasks:
520
500
- echo "{{.GREETING}}"
521
501
` ` `
522
502
523
- Example of `Taskvars.yml` file :
524
-
525
- ` ` ` yaml
526
- PROJECT_NAME: My Project
527
- DEV_MODE: production
528
- GIT_COMMIT: {sh: git log -n 1 --format=%h}
529
- ` ` `
530
-
531
503
# ## Dynamic variables
532
504
533
505
The below syntax (`sh:` prop in a variable) is considered a dynamic variable.
0 commit comments