Skip to content

Commit

Permalink
v.0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jan 26, 2021
1 parent b29bb20 commit 670e124
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions makesure_stable
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ function handleReachedIf( goal_name) {
ReachedIf[goal_name] = trim($0)
}
function doWork( i,j,goal_name,dep_cnt,dep,reached_if,reached,my_dir,defines_line,
body,goal_body,goal_bodies,resolved_goals,exit_code, t0,t1,t2) {
function doWork( i,j,goal_name,dep_cnt,dep,reached_if,reached_goals,empty_goals,my_dir,defines_line,
body,goal_body,goal_bodies,resolved_goals,exit_code, t0,t1,t2, goal_timed) {
if ("-l" in Args || "--list" in Args) {
print "Available goals:"
Expand Down Expand Up @@ -223,15 +223,16 @@ function doWork( i,j,goal_name,dep_cnt,dep,reached_if,reached,my_dir,defines_
body = trim(code[goal_name])
reached_if = ReachedIf[goal_name]
reached = reached_if ? checkConditionReached(defines_line[0], reached_if) : 0
reached_goals[goal_name] = reached_if ? checkConditionReached(defines_line[0], reached_if) : 0
empty_goals[goal_name] = length(body) == 0
# check valid dependencies
dep_cnt = DependenciesCnt[goal_name]
for (j=0; j < dep_cnt; j++) {
dep = Dependencies[goal_name, j]
if (!(dep in GoalsByName))
dieMsg("Goal '" goal_name "' has unknown dependency '" dep "'") # TODO find a way to provide line reference
if (!reached) {
if (!reached_goals[goal_name]) {
# we only add a dependency to this goal if it's not reached
#print " [not reached] " goal_name " -> " dep
topologicalSortAddConnection(goal_name, dep)
Expand All @@ -243,15 +244,15 @@ function doWork( i,j,goal_name,dep_cnt,dep,reached_if,reached,my_dir,defines_
goal_body[0] = ""
if (!("silent" in Options)) {
addStr(goal_body, "echo \" goal '" goal_name "' ")
if (reached)
if (reached_goals[goal_name])
addStr(goal_body, "[already satisfied].")
else if (length(body) == 0)
else if (empty_goals[goal_name])
addStr(goal_body, "[empty].")
else
addStr(goal_body, "...")
addLine(goal_body, "\"")
}
if (reached)
if (reached_goals[goal_name])
addLine(goal_body, "exit 0")
addLine(goal_body, defines_line[0])
Expand All @@ -272,19 +273,20 @@ function doWork( i,j,goal_name,dep_cnt,dep,reached_if,reached,my_dir,defines_
}
} else {
for (i = 0; i < arrLen(resolved_goals); i++) {
if ("timing" in Options)
t1 = currentTimeMillis()
goal_name = resolved_goals[i]
goal_timed = "timing" in Options && !reached_goals[goal_name] && !empty_goals[goal_name]
if (goal_timed)
t1 = t2 ? t2 : currentTimeMillis()
exit_code = shellExec(goal_bodies[goal_name])
if ("timing" in Options) {
if (goal_timed) {
t2 = currentTimeMillis()
print " goal '" goal_name "' took " renderDuration(t2 - t1)
}
if (exit_code != 0)
break
}
if ("timing" in Options)
print " total time " renderDuration(t2 - t0)
print " total time " renderDuration((t2 ? t2 : currentTimeMillis()) - t0)
if (exit_code != 0)
realExit(exit_code)
}
Expand Down

0 comments on commit 670e124

Please sign in to comment.