-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makesure can not be used to execute two goals with effects that counter each other #171
Comments
This is interesting question indeed. For sure changing the operational semantics can hurt the intended declarative nature of the tool. For example, now any goal runs at most one time, even if depended on multiple times. I think the root of the issue is that dependency on a goal is not equivalent to a goal invocation. What you could also try is something like:
I see how it’s bulky and repetitive, though. Also the example with a file, though serves a good role of showing the problem, looks a bit abstract. If possible, I would like to see a more realistic example (from real project). This could help finding more elegant/appropriate solution. |
A practical example would be the following, a chain of goals for task that is meant to be executed at regular intervals and that cleans up after itself:
Given an empty directory and docker cache, the latter two goals would never be executed, leaving the files around. In the end, I guess there is no right or wrong here, it's a matter of preference when to evaluate the reached_ifs. In the end, the same effect can be achieved by replacing |
I'm considering the next idea. In your initial example you will have: @goal 'x-updated'
@call 'x-deleted'
@call 'x-created' So using @goal 'x-updated'
"$MAKESURE" x-deleted
"$MAKESURE" x-created Many things to consider with this approach, but may be good enough for the scenario you describe and the like.
|
I sometimes need to implement update tasks.
A basic setup can look like this:
Now the update task would look like this:
This does not work, since the reached-checks are checked during build graph construction, as far as I can tell.
Workarounds:
./makesure
inx-updated
instead of dependencies../makesure x-updated
twice.I could think of ways for makesure to support this better:
reached_if
-checks could happen before goal execution (but I guess that would change too much of makesure's behavior).$SHLVL
.I'm writing this primarily to start discussion, since I use makesure quite heavily at the moment. What do you think about this?
The text was updated successfully, but these errors were encountered: