Skip to content

Commit

Permalink
bugfix: inadvertent replacement of MAKEFILE_LIST var breaking tasks list
Browse files Browse the repository at this point in the history
  • Loading branch information
evnp committed Sep 5, 2024
1 parent 6eed448 commit 2bab52f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Runfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ stop: # stop app
b build: lint # build app for environment [vars: env]
[[ -n $(env) ]] && echo "buiding app for $(env)" || echo "error: missing env"

t test: build # run all tests or specific tests [vars: name1, name2, etc.]
t test: # run all tests or specific tests [vars: name1, name2, etc.]
run build env=test
[[ -n $(@) ]] && echo "running tests $(@)" || echo "running all tests"

l lint: # lint all files or specific file [vars: file]
Expand Down
11 changes: 9 additions & 2 deletions runfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ EOF
if ! (( ${#cmd_args[@]} ))
then
# Case where no named arguments were provided: replace $(abc) $(xyz) etc.
buffer="$( echo "${buffer}" | sed -E 's!\$\([a-zA-Z_][a-zA-Z0-9_]*\)!``!g' )"
# Note: There must be at least one lowercase letter [a-z] in these matches,
# because otherwise we'd replace built in Make vars like $(MAKEFILE_LIST)
# which we want to leave alone.
buffer="$( echo "${buffer}" | sed -E 's!\$\([a-zA-Z0-9_]*[a-z][a-zA-Z0-9_]*\)!``!g' )"
fi
if ! (( ${#pos_args[@]} ))
then
Expand Down Expand Up @@ -247,8 +250,12 @@ EOF
then
make_args+=( "${cmd}" )
fi
if (( ${#cmd_args[@]} ))
then
make_args+=( -- "${cmd_args[@]}" )
fi
make --makefile "${makefile}" "${make_args[@]}" -- "${cmd_args[@]}"
make --makefile "${makefile}" "${make_args[@]}"
# Clean up temporary Makefile and exit with success:
rm "${makefile}"
Expand Down

0 comments on commit 2bab52f

Please sign in to comment.