Skip to content
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

Don't evaluate @reached_if unless the goal is required #104

Closed
08d2 opened this issue Feb 6, 2022 · 2 comments
Closed

Don't evaluate @reached_if unless the goal is required #104

08d2 opened this issue Feb 6, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@08d2
Copy link

08d2 commented Feb 6, 2022

Thanks for the brilliant tool.

I have a Makesurefile with goals that are intended to be executed in different environments. Concretely, there is a @goal build which I can run on my macOS laptop, and a @goal install which only makes sense to run on my Debian server. The install goal has some transitive goals with @reached_if directives that invoke systemctl. When I makesure build on my laptop, I get some errors about systemctl not being installed. It seems that all @reached_if directives in a Makesurefile are evaluated greedily, even if the requested goal wouldn't ever reach them. I guess that would ideally not be the case :)

@xonixx
Copy link
Owner

xonixx commented Feb 6, 2022

Thank you for your kind words and the proposal.

Your guess of greedy @reached_if evaluation is correct. The reason for this is that this information is used for topological sort routine needed to determine the correct execution order of goals.

However I totally agree that from a user perspective your request is completely valid and rational. I’ll check with implementation and will be glad if I can find a way to make it work this way without breaking things. Not only this is more logical but also should be more efficient.

@xonixx xonixx changed the title Don't evaluate @reached_if unless the goal is required Don't evaluate @reached_if unless the goal is required Feb 7, 2022
@xonixx xonixx self-assigned this Feb 8, 2022
@xonixx xonixx added the enhancement New feature or request label Feb 8, 2022
@xonixx xonixx added this to the 0.9.18 milestone Feb 8, 2022
@xonixx
Copy link
Owner

xonixx commented Feb 9, 2022

Interesting, that digging into this issue revealed other minor issue (now fixed). The loops were not reported properly in presence of @reached_if:

@goal a
@reached_if true
@depends_on b
  echo a

@goal b
@depends_on a
  echo b

@xonixx xonixx closed this as completed Feb 9, 2022
@xonixx xonixx mentioned this issue Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants