From 7488d9917872c979797b23ef3bf836502f78b796 Mon Sep 17 00:00:00 2001 From: xonix Date: Tue, 12 Jan 2021 15:46:37 +0200 Subject: [PATCH] remove support for -p option --- Makesure.md | 2 +- makesure | 31 +++---------------------------- tests/1_goals.tush | 11 ----------- tests/4_trace.tush | 5 ----- tests/6_reached_if.tush | 6 ------ 5 files changed, 4 insertions(+), 51 deletions(-) diff --git a/Makesure.md b/Makesure.md index d8b618d..6e22a6c 100644 --- a/Makesure.md +++ b/Makesure.md @@ -12,7 +12,7 @@ 5. [ ] Find a way to share functions 6. [ ] Pre-check? Post-check? 7. [x] make @shell configurable -8. [x] `-p` flag to print generated bash script +8. [ ] \[REJECT] `-p` flag to print generated bash script 9. [x] provide goals to run as argument 10. [x] `-l` flag to show all goals 11. [x] per-goal documentation diff --git a/makesure b/makesure index cbb4a99..b008db5 100755 --- a/makesure +++ b/makesure @@ -146,14 +146,10 @@ function handle_reached_if( goal_name) { ReachedIf[goal_name] = trim($0) } -function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_dir, +function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,my_dir, body,prelude_body,goal_body,goal_bodies, resolved_goals,cmd,exit_code, t0,t1,t2) { - script = "" - -# if ("tracing" in Options) -# script = issue_line(script, "set -x") if ("timing" in Options) t0 = current_time_millis() @@ -169,15 +165,12 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_di # prelude body = trim(code[""]) prelude_body = body - script = issue_line(script, my_dir prelude_body) for (i = 0; i < arr_len(GoalNames); i++) { goal_name = GoalNames[i] body = trim(code[goal_name]) - script = issue_line(script, "\n" goal_name "() {") - reached_if_condition = ReachedIf[goal_name] # check valid dependencies @@ -200,8 +193,6 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_di body = ":" } - script = issue_line(script, "\n" Shell " -e <<'EOF'") - goal_body = "" if (!("silent" in Options)) { goal_body = issue_line(goal_body, " printf \" goal '" goal_name "' \"") @@ -223,15 +214,9 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_di goal_body = issue_line(goal_body, " " body) goal_bodies[goal_name] = goal_body - - script = issue_line(script, goal_body "EOF\n") - script = issue_line(script, "}") } - script = issue_resolved_goals_to_run(script, resolved_goals) - # cleanup - if (DefinesFile) - script = issue_line(script, "rm " DefinesFile) + resolve_goals_to_run(resolved_goals) if ("-d" in Args || "--resolved" in Args) { printf("Resolved goals to reach for '%s':\n", join(ArgGoals, 0, arr_len(ArgGoals), " ")) @@ -248,8 +233,6 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_di print " " Doc[goal_name, j] } } - } else if ("-p" in Args || "--print" in Args) { - print script } else { exit_code = shell_exec(my_dir prelude_body) if (exit_code != 0) @@ -276,7 +259,7 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,script,my_di } } -function issue_resolved_goals_to_run(script, result, i, goal_name, loop) { +function resolve_goals_to_run(result, i, goal_name, loop) { if (arr_len(ArgGoals) == 0) arr_push(ArgGoals, "default") @@ -291,14 +274,6 @@ function issue_resolved_goals_to_run(script, result, i, goal_name, loop) { if (loop[0] == 1) { die_msg("There is a loop in goal dependencies via " loop[1] " -> " loop[2]) } - - script = issue_line(script, "__resolved_goals() {") - for (i = 0; i < arr_len(result); i++) { - script = issue_line(script, " " result[i]) - } - script = issue_line(script, "}") - script = issue_line(script, "__resolved_goals") - return script } function issue_line(script, line) { diff --git a/tests/1_goals.tush b/tests/1_goals.tush index cd21dd7..46ac4e5 100644 --- a/tests/1_goals.tush +++ b/tests/1_goals.tush @@ -22,17 +22,6 @@ $ cd "$MYDIR"; ./makesure -f tests/1_goals.sh --silent | bbb | aaa -$ cd "$MYDIR"; ./makesure -f tests/1_goals.sh -p | bash -| goal 'ddd' ... -| ddd -| goal 'ccc' ... -| ccc -| goal 'bbb' ... -| bbb -| goal 'aaa' ... -| aaa -| goal 'default' [empty]. - $ cd "$MYDIR"; ./makesure -f tests/1_goals.sh -l | Available goals: | default diff --git a/tests/4_trace.tush b/tests/4_trace.tush index 0dec92b..a184329 100644 --- a/tests/4_trace.tush +++ b/tests/4_trace.tush @@ -8,11 +8,6 @@ $ cd "$MYDIR"; ./makesure -f tests/4_trace.sh -x | A=aaa @ + echo A=aaa -$ cd "$MYDIR"; ./makesure -f tests/4_trace.sh -x -p | bash -| goal 'default' ... -| A=aaa -@ + echo A=aaa - $ cd "$MYDIR"; ./makesure -f tests/4_trace.sh --tracing | goal 'default' ... | A=aaa diff --git a/tests/6_reached_if.tush b/tests/6_reached_if.tush index 2d61c9a..ab2ee8c 100644 --- a/tests/6_reached_if.tush +++ b/tests/6_reached_if.tush @@ -5,12 +5,6 @@ $ cd "$MYDIR"; ./makesure -f tests/6_reached_if.sh | aaa | goal 'default' [empty]. -$ cd "$MYDIR"; ./makesure -f tests/6_reached_if.sh -p | bash -| goal 'bbb' [already satisfied]. -| goal 'aaa' ... -| aaa -| goal 'default' [empty]. - $ cd "$MYDIR"; ./makesure -f tests/6_reached_if.sh -d | Resolved goals to reach for 'default': | bbb