fix: run once in shared dependencies #1655
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #852
This PR changes the hash we use when a task is marked as
run:once
. Previously we used the full name of the task. This is fine most of the time, but when a task in an included Taskfile is included multiple times, the name will contain a namespace that is different for each task. Using the example given in #852, the hashes produced are:As a result
library:build
is run twice, even though it is marked asrun: once
.In this PR, we are creating a hash that is a combination of the file location and the name of the task without a namespace. This means that the hash is unique for each task, but will be the same when a task is included in different namespaces.
Note
As discussed below, we're no longer focussing on the second problem in this PR. We're open to further discussion in another issue for anyone coming across this in the future.
#852 mentions a secondary problem:
You can see this illustrated below:
We need to determine the correct behaviour:
run: once
is specified - This still has the same problem as above. However, you could argue that the user has made a mistake by addingrun: once
when the result of a task could be different depending on the context.If we choose 2 or 3, then what should the task hash be?
<location>:service-a:build
(probably not)<location>:service-b:build
(also probably not)I would appreciate any thoughts/feedback on these options - or other options entirely.