Tweak mf helper scripts

This commit is contained in:
Scott Lahteine 2021-03-23 23:58:53 -05:00
parent e5ff55a1be
commit 155dea6f14
2 changed files with 11 additions and 8 deletions

View File

@ -28,6 +28,7 @@ OPTIONS
-a --autobuild PIO Build using the MOTHERBOARD environment. -a --autobuild PIO Build using the MOTHERBOARD environment.
-u --autoupload PIO Upload using the MOTHERBOARD environment. -u --autoupload PIO Upload using the MOTHERBOARD environment.
-v --verbose Extra output for debugging. -v --verbose Extra output for debugging.
-s --silent Silence build output from PlatformIO.
env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41 env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
" "
@ -62,6 +63,7 @@ while getopts 'abhmruvyn:t:-:' OFLAG; do
esac esac
;; ;;
r) REBUILD=1 ; bugout "Rebuilding previous..." ;; r) REBUILD=1 ; bugout "Rebuilding previous..." ;;
s) SILENT_FLAG="-s" ;;
t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;; t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;;
u) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;; u) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
v) DEBUG=1 ; bugout "Debug ON" ;; v) DEBUG=1 ; bugout "Debug ON" ;;
@ -105,8 +107,8 @@ if ((REBUILD)); then
# Build with the last-built env # Build with the last-built env
[[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; } [[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; }
read TESTENV <"$STATE_FILE" read TESTENV <"$STATE_FILE"
pio run -s -d . -e $TESTENV pio run $SILENT_FLAG -d . -e $TESTENV
exit exit 0
fi fi
case $TESTENV in case $TESTENV in
@ -189,12 +191,12 @@ if ((AUTO_BUILD)); then
if ((AUTO_BUILD == 2)); then if ((AUTO_BUILD == 2)); then
echo "Uploading environment $TARGET for board $MB ($BNUM)..." ; echo echo "Uploading environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -t upload -e $TARGET pio run $SILENT_FLAG -t upload -e $TARGET
else else
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -s -e $TARGET pio run $SILENT_FLAG -e $TARGET
fi fi
exit exit 0
fi fi
# #
@ -306,6 +308,6 @@ fi
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && { [[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE ((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE
((USE_MAKE)) || pio run -s -d . -e $TESTENV ((USE_MAKE)) || pio run $SILENT_FLAG -d . -e $TESTENV
echo "$TESTENV" >"$STATE_FILE" echo "$TESTENV" >"$STATE_FILE"
} }

View File

@ -4,7 +4,7 @@
# #
# - git add . # - git add .
# - git commit --amend # - git commit --amend
# - ghpc # - git push -f
# #
MFINFO=$(mfinfo "$@") || exit 1 MFINFO=$(mfinfo "$@") || exit 1
@ -17,6 +17,7 @@ IND=6
while [ $IND -lt ${#INFO[@]} ]; do while [ $IND -lt ${#INFO[@]} ]; do
ARG=${INFO[$IND]} ARG=${INFO[$IND]}
case "$ARG" in case "$ARG" in
-f|--force ) FORCE=1 ;;
-h|--help ) USAGE=1 ;; -h|--help ) USAGE=1 ;;
* ) USAGE=1 ; echo "unknown option: $ARG" ;; * ) USAGE=1 ; echo "unknown option: $ARG" ;;
esac esac
@ -25,6 +26,6 @@ done
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; } [[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; }
[[ $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; } [[ $FORCE != 1 && $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; }
git add . && git commit --amend && git push -f git add . && git commit --amend && git push -f