1
0
mirror of https://github.com/go-task/task.git synced 2025-06-15 00:15:10 +02:00

Add "output" options to the Taskfile

Also, fix handling of Taskfile by making the version an instance of
`semver.Constraints` instead of `semver.Version`. This makes the version
works as described on TASKFILE_VERSIONS.md document, i.e. version "2" will
include "2.x" features but version "2.0" not.
This commit is contained in:
Andrey Nering
2018-04-15 11:11:07 -03:00
parent 2cb2668803
commit 8b3c34c308
3 changed files with 26 additions and 25 deletions

11
task.go
View File

@ -79,7 +79,7 @@ func (e *Executor) Setup() error {
return err
}
v, err := semver.NewVersion(e.Taskfile.Version)
v, err := semver.NewConstraint(e.Taskfile.Version)
if err != nil {
return fmt.Errorf(`task: could not parse taskfile version "%s": %v`, e.Taskfile.Version, err)
}
@ -108,7 +108,7 @@ func (e *Executor) Setup() error {
Vars: e.taskvars,
Logger: e.Logger,
}
case version.IsV2(v):
case version.IsV2(v), version.IsV21(v):
e.Compiler = &compilerv2.CompilerV2{
Dir: e.Dir,
Taskvars: e.taskvars,
@ -116,8 +116,11 @@ func (e *Executor) Setup() error {
Expansions: e.Taskfile.Expansions,
Logger: e.Logger,
}
case version.IsV21(v):
return fmt.Errorf(`task: Taskfile versions greater than v2 not implemented in the version of Task`)
case version.IsV22(v):
return fmt.Errorf(`task: Taskfile versions greater than v2.1 not implemented in the version of Task`)
}
if !version.IsV21(v) && e.Taskfile.Output != "" {
return fmt.Errorf(`task: Taskfile option "output" is only available starting on Taskfile version v2.1`)
}
e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks))