minimal/do: invert the sense of the -c option.
After playing with "continuable" mode for a while, it seems to me that what most people want will be incremental builds by default (albeit without any dependency checking to rebuild a target if sources change). This lets you run minimal/do several times in a row to incrementally build up your project while you're playing around. If you want to start over, use -c. As a result, in test.do we now recommend using 'minimal/do -c test' since minimal/do now strays even further from proper redo semantics otherwise. While we're here, update the usage message to describe what all the new options mean.
This commit is contained in:
parent
e40dc5bad2
commit
b0a6bd79f9
2 changed files with 18 additions and 10 deletions
26
minimal/do
26
minimal/do
|
|
@ -4,8 +4,18 @@
|
|||
# For the full version, visit http://github.com/apenwarr/redo
|
||||
#
|
||||
# The author disclaims copyright to this source file and hereby places it in
|
||||
# the public domain. (2010 12 14)
|
||||
# the public domain. (2010 12 14; updated 2018 10 31)
|
||||
#
|
||||
USAGE="
|
||||
usage: $0 [-d] [-x] [-v] [-c] <targets...>
|
||||
-d print extra debug messages (mostly about dependency checks)
|
||||
-v run .do files with 'set -v'
|
||||
-x run .do files with 'set -x'
|
||||
-c clean up all old targets before starting
|
||||
|
||||
Note: $0 is an implementation of redo that does *not* check dependencies.
|
||||
It will never rebuild a target it has already built, unless you use -c.
|
||||
"
|
||||
|
||||
# By default, no output coloring.
|
||||
green=""
|
||||
|
|
@ -40,15 +50,15 @@ if [ -z "$DO_BUILT" ]; then
|
|||
export _do_opt_debug=
|
||||
export _do_opt_exec=
|
||||
export _do_opt_verbose=
|
||||
export _do_opt_continuable=
|
||||
export _do_opt_clean=
|
||||
fi
|
||||
while getopts dxvc _opt; do
|
||||
while getopts 'dxvch?' _opt; do
|
||||
case $_opt in
|
||||
d) _do_opt_debug=1 ;;
|
||||
x) _do_opt_exec=x ;;
|
||||
v) _do_opt_verbose=v ;;
|
||||
c) _do_opt_continuable=1 ;;
|
||||
*) printf "\nusage: $0 [-d] [-x] [-v] [-c] <targets...>\n" >&2
|
||||
c) _do_opt_clean=1 ;;
|
||||
\?|h|*) printf "%s" "$USAGE" >&2
|
||||
exit 99
|
||||
;;
|
||||
esac
|
||||
|
|
@ -64,7 +74,7 @@ if [ -z "$DO_BUILT" ]; then
|
|||
export DO_BUILT=$PWD/.do_built
|
||||
: >>"$DO_BUILT"
|
||||
sort -u "$DO_BUILT" >"$DO_BUILT.new"
|
||||
if [ -z "$_do_opt_continuable" ]; then
|
||||
if [ -n "$_do_opt_clean" ]; then
|
||||
echo "Removing previously built files..." >&2
|
||||
while read f; do printf "%s\0%s.did\0" "$f" "$f"; done <"$DO_BUILT.new" |
|
||||
xargs -0 rm -f 2>/dev/null
|
||||
|
|
@ -84,8 +94,6 @@ if [ -z "$DO_BUILT" ]; then
|
|||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
_find_dofile_pwd()
|
||||
{
|
||||
dofile=default.$1.do
|
||||
|
|
@ -201,7 +209,7 @@ _redo "$@"
|
|||
[ "$?" = 0 ] || exit 1
|
||||
|
||||
if [ -n "$DO_TOP" ]; then
|
||||
if [ -z "$_do_opt_continuable" ]; then
|
||||
if [ -n "$_do_opt_clean" ]; then
|
||||
echo "Removing stamp files..." >&2
|
||||
[ ! -e "$DO_BUILT" ] ||
|
||||
while read f; do printf "%s.did\0" "$f"; done <"$DO_BUILT" |
|
||||
|
|
|
|||
2
test.do
2
test.do
|
|
@ -1,3 +1,3 @@
|
|||
redo-ifchange _all
|
||||
redo t/all
|
||||
[ -n "$DO_BUILT" ] || echo "Don't forget to test 'minimal/do test'" >&2
|
||||
[ -n "$DO_BUILT" ] || echo "Don't forget to test 'minimal/do -c test'" >&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue