Skip to content

Commit

Permalink
build(task): simplify and make DRY
Browse files Browse the repository at this point in the history
Use the `for` loop built into Task.
  • Loading branch information
dbohdan committed Dec 6, 2024
1 parent 3e87cfe commit b26c342
Showing 1 changed file with 12 additions and 40 deletions.
52 changes: 12 additions & 40 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,62 +69,34 @@ tasks:

build_test_binaries:
desc: 'Build all test binaries'
deps:
- build_test_env
- build_test_exit99
- build_test_hello
- build_test_sleep

build_test_env:
cmds:
- task: build_binary
vars:
src: test/env.go
out: test/env
src: '{{.test_binary}}.go'
out: '{{.test_binary}}{{.ext}}'
for:
var: test_binaries
as: test_binary
sources:
- test/env.go
generates:
- test/env

build_test_exit99:
cmds:
- task: build_binary
vars:
src: test/exit99.go
out: test/exit99
sources:
- test/exit99.go
generates:
- test/exit99

build_test_hello:
cmds:
- task: build_binary
vars:
src: test/hello.go
out: test/hello
sources:
- test/hello.go
generates:
- test/hello

build_test_sleep:
cmds:
- task: build_binary
vars:
src: test/sleep.go
out: test/sleep
sources:
- test/sleep.go
generates:
- test/env
- test/exit99
- test/hello
- test/sleep

clean:
desc: 'Clean up binaries and generated files'
cmds:
- rm -f README.md
- rm -f {{.subdir | shellQuote}}/recur
- rm -f {{range .test_binaries | splitLines }}{{. | shellQuote}} {{end}}
- cmd: rm -f {{.test_binary | shellQuote}}
for:
var: test_binaries
as: test_binary

release:
desc: 'Prepare a release'
Expand Down

0 comments on commit b26c342

Please sign in to comment.