Skip to content

Commit

Permalink
Don't evaluate @reached_if unless the goal is required #104 rfct
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Feb 8, 2022
1 parent 0c6f05e commit 1b85844
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
if (timingOn())
t0 = currentTimeMillis()

preludeCode = getPreludeCode()

for (i = 0; i in GoalNames; i++) {
depCnt = DependenciesCnt[goalName = GoalNames[i]]
for (j=0; j < depCnt; j++) {
Expand All @@ -408,9 +406,11 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
}

# first do topological sort disregarding @reached_if to catch loops
resolveGoalsToRun(0,GoalNames)
topologicalSort(0,GoalNames)
# now do topological sort including @reached_if to resolve goals to run
resolveGoalsToRun(1,ArgGoals,resolvedGoals,reachedGoals)
topologicalSort(1,ArgGoals,resolvedGoals,reachedGoals)

preludeCode = getPreludeCode()

for (i = 0; i in GoalNames; i++) {
goalName = GoalNames[i]
Expand Down Expand Up @@ -463,7 +463,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
}
}

function resolveGoalsToRun(includeReachedIf,requestedGoals,result,reachedGoals, i,goalName,loop) {
function topologicalSort(includeReachedIf,requestedGoals,result,reachedGoals, i,goalName,loop) {
topologicalSortReset()

if (arrLen(requestedGoals) == 0)
Expand Down Expand Up @@ -510,15 +510,6 @@ function checkConditionReached(goalName, conditionStr, script) {
return shellExec(script, goalName "@reached_if") == 0
}

function checkConditionReachedScript(goalName, definesLine, conditionStr, script) {
script = definesLine # need this to initialize variables for check conditions
if (goalName in GoalToLib)
script = script "\n" Lib[GoalToLib[goalName]]
script = script "\n" conditionStr
#print "script: " script
return script
}

function shellExec(script, comment, res) {
if ("tracing" in Options) {
script = ": " quoteArg(comment) "\n" script
Expand Down

0 comments on commit 1b85844

Please sign in to comment.