task
task copied to clipboard
Provide equivelent of make's `--touch`
Make's --touch
option allows the explicit marking of a target and it's dependencies as up-to-date, even if their outputs don't exist. It would be helpful to have an equivilent function in task which works for both the timestamp and checksum methods of fingerprinting.
Use case
- We define testing targets which depend on building a binary asset.
- In our CI system we build the binary asset once before starting parallel jobs for each testing target.
- When starting each testing target we restore the finary binary asset from the first stage, but not any intermediate assets, then mark the target as up-to-date with
--touch
.
Example task flow:
┌─────► test suite A
│
prerequisite ────► build ─┼─────► test suite B
│
└─────► test suite C
Workarounds
- Rebuild the binary assets on each of testing jobs (not ideal)
- Remove the task dependencies between the test tasks and the binary asset (not ideal for local development)
- Create additional testing targets - one of each for local testing and one of each for CI.
- Create a manual
touch
task to manually create stub intermediate assets. This only works if using timestamp fingerprinting.
Hi @danielrbradley, thanks for opening this issue!
I'd be happy to review a pull request for this!
Implementation tips:
- For
timestamp
tasks, it's just a matter of updating the destination files timestamp. That's what Make do- Questions:
- If destination files does not exist, should we create it as empty?
- And what if a task only have a star glob (
dir/**.go
) ingenerates
? We don't know how to name the file in that dir
- Questions:
- For
checksum
tasks, we need to update the checksum file inside the.task
dir while skipping everything else
https://github.com/go-task/task/blob/c9a582fbcc81aa86fe9e5b9b38fb8de10c342583/internal/status/checksum.go#L46-L49