diff --git a/buildroot/bin/build_all_examples b/buildroot/bin/build_all_examples index 91870ab15..bce95dce8 100755 --- a/buildroot/bin/build_all_examples +++ b/buildroot/bin/build_all_examples @@ -30,24 +30,37 @@ echo "This script downloads all Configurations and builds Marlin with each one." echo "On failure the last-built configs will be left in your working copy." echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'." +unset BRANCH +unset FIRST_CONF +if [[ -f "$STAT_FILE" ]]; then + IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE" +fi + # If -c is given start from the last attempted build if [[ $1 == '-c' ]]; then - if [[ -f "$STAT_FILE" ]]; then - read BRANCH FIRST_CONF <"$STAT_FILE" - else + if [[ -z $BRANCH || -z $FIRST_CONF ]]; then echo "Nothing to continue" exit fi +elif [[ $1 == '-s' ]]; then + if [[ -n $BRANCH && -n $FIRST_CONF ]]; then + SKIP_CONF=1 + else + echo "Nothing to skip" + exit + fi else BRANCH=${1:-"import-2.0.x"} FIRST_CONF=$2 fi # Check if the current repository has unmerged changes -if [[ -z "$FIRST_CONF" ]]; then - git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } -else +if [[ $SKIP_CONF ]]; then + echo "Skipping $FIRST_CONF" +elif [[ $FIRST_CONF ]]; then echo "Resuming from $FIRST_CONF" +else + git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } fi # Create a temporary folder inside .pio @@ -67,12 +80,19 @@ shopt -s nullglob IFS=' ' CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" ) +DOSKIP=0 for CONF in $CONF_TREE ; do + # Get a config's directory name DIR=$( echo $CONF | sed "s|$TMP/config/examples/||" ) - [[ ! -z $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue + # If looking for a config, skip others + [[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue + # Once found, stop looking unset FIRST_CONF + # If skipping, don't build the found one + [[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; } + # ...if skipping, don't build this one compgen -G "${CONF}Con*.h" > /dev/null || continue - echo -e "$BRANCH\n$DIR" >"$STAT_FILE" + echo "${BRANCH}*${DIR}" >"$STAT_FILE" "$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } done diff --git a/buildroot/bin/build_example b/buildroot/bin/build_example index 3c19b7b62..8ebb58f97 100755 --- a/buildroot/bin/build_example +++ b/buildroot/bin/build_example @@ -24,6 +24,6 @@ cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null echo "Building the firmware now..." HERE=`dirname "$0"` -$HERE/mftest -a || { echo "Failed"; exit 1; } +$HERE/mftest -a -n1 || { echo "Failed"; exit 1; } echo "Success" diff --git a/buildroot/bin/mftest b/buildroot/bin/mftest index 4626352f7..00f7a2e7e 100755 --- a/buildroot/bin/mftest +++ b/buildroot/bin/mftest @@ -105,7 +105,7 @@ if ((REBUILD)); then # Build with the last-built env [[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; } read TESTENV <"$STATE_FILE" - pio run -d . -e $TESTENV + pio run -s -d . -e $TESTENV exit fi @@ -192,7 +192,7 @@ if ((AUTO_BUILD)); then pio run -t upload -e $TARGET else echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo - pio run -e $TARGET + pio run -s -e $TARGET fi exit fi @@ -307,6 +307,6 @@ fi [[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && { ((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE - ((USE_MAKE)) || pio run -d . -e $TESTENV + ((USE_MAKE)) || pio run -s -d . -e $TESTENV echo "$TESTENV" >"$STATE_FILE" }