mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-25 15:44:02 -06:00
🧑💻 Keep state for build_all_examples --limit
This commit is contained in:
parent
2634d0cc52
commit
8cf4c0515d
3 changed files with 34 additions and 29 deletions
|
@ -14,27 +14,11 @@
|
||||||
# build_all_examples [...] branch [resume-from]
|
# build_all_examples [...] branch [resume-from]
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
. mfutil
|
||||||
|
|
||||||
GITREPO=https://github.com/MarlinFirmware/Configurations.git
|
GITREPO=https://github.com/MarlinFirmware/Configurations.git
|
||||||
STAT_FILE=./.pio/.buildall
|
STAT_FILE=./.pio/.buildall
|
||||||
|
|
||||||
# Check dependencies
|
|
||||||
which curl 1>/dev/null 2>&1 || { echo "curl not found! Please install it."; exit ; }
|
|
||||||
which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; }
|
|
||||||
|
|
||||||
SED=$(command -v gsed 2>/dev/null || command -v sed 2>/dev/null)
|
|
||||||
[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; }
|
|
||||||
|
|
||||||
SELF=`basename "$0"`
|
|
||||||
HERE=`dirname "$0"`
|
|
||||||
|
|
||||||
# Check if called in the right location
|
|
||||||
[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; }
|
|
||||||
|
|
||||||
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
|
|
||||||
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }
|
|
||||||
|
|
||||||
usage() { echo "
|
usage() { echo "
|
||||||
Usage: $SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-r|--resume=<path>]
|
Usage: $SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-r|--resume=<path>]
|
||||||
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-c|--continue]
|
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-c|--continue]
|
||||||
|
@ -58,7 +42,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
|
||||||
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
|
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
|
||||||
i) CREATE_INI=1 ; bugout "Generate an INI file" ;;
|
i) CREATE_INI=1 ; bugout "Generate an INI file" ;;
|
||||||
h) EXIT_USAGE=1 ; break ;;
|
h) EXIT_USAGE=1 ; break ;;
|
||||||
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT configs" ;;
|
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
|
||||||
d|v) DEBUG=1 ; bugout "Debug ON" ;;
|
d|v) DEBUG=1 ; bugout "Debug ON" ;;
|
||||||
n) DRYRUN=1 ; bugout "Dry Run" ;;
|
n) DRYRUN=1 ; bugout "Dry Run" ;;
|
||||||
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
|
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
|
||||||
|
@ -67,7 +51,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
|
||||||
resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;;
|
resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;;
|
||||||
continue) CONTINUE=1 ; bugout "Continue" ;;
|
continue) CONTINUE=1 ; bugout "Continue" ;;
|
||||||
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
|
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
|
||||||
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT configs" ;;
|
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
|
||||||
ini) CREATE_INI=1 ; bugout "Generate an INI file" ;;
|
ini) CREATE_INI=1 ; bugout "Generate an INI file" ;;
|
||||||
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
|
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
|
||||||
debug) DEBUG=1 ; bugout "Debug ON" ;;
|
debug) DEBUG=1 ; bugout "Debug ON" ;;
|
||||||
|
@ -125,18 +109,17 @@ TMP=./.pio/build-$BRANCH
|
||||||
|
|
||||||
# Download Configurations into the temporary folder
|
# Download Configurations into the temporary folder
|
||||||
if [[ ! -e "$TMP/README.md" ]]; then
|
if [[ ! -e "$TMP/README.md" ]]; then
|
||||||
echo "Downloading Configurations from GitHub into $TMP"
|
echo "Fetching Configurations from GitHub to $TMP"
|
||||||
git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$TMP" || { echo "Failed to clone the configuration repository"; exit ; }
|
git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$TMP" || { echo "Failed to clone the configuration repository"; exit ; }
|
||||||
else
|
else
|
||||||
echo "Using previously downloaded Configurations at $TMP"
|
echo "Using cached Configurations at $TMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "Start building now...\n====================="
|
echo -e "Start build...\n====================="
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" )
|
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
|
for CONF in $CONF_TREE ; do
|
||||||
|
|
||||||
# Get a config's directory name
|
# Get a config's directory name
|
||||||
|
@ -168,19 +151,19 @@ for CONF in $CONF_TREE ; do
|
||||||
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \;
|
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((LIMIT--)) || { echo "Limit reached" ; break ; }
|
((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Delete the build state
|
# Delete the build state if not paused early
|
||||||
rm "$STAT_FILE"
|
[[ $PAUSE ]] || rm "$STAT_FILE"
|
||||||
|
|
||||||
# Delete the temp folder if not preserving generated INI files
|
# Delete the temp folder if not preserving generated INI files
|
||||||
if [[ -e "$TMP/config/examples" ]]; then
|
if [[ -e "$TMP/config/examples" ]]; then
|
||||||
if [[ $CREATE_INI ]]; then
|
if [[ $CREATE_INI ]]; then
|
||||||
OPEN=$( which gnome-open xdg-open open | head -n1 )
|
OPEN=$( which gnome-open xdg-open open | head -n1 )
|
||||||
$OPEN "$TMP"
|
$OPEN "$TMP"
|
||||||
else
|
elif [[ ! $PAUSE ]]; then
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
# Usage: build_example internal config-home config-folder
|
# Usage: build_example internal config-home config-folder
|
||||||
#
|
#
|
||||||
|
|
||||||
|
. mfutil
|
||||||
|
|
||||||
# Require 'internal' as the first argument
|
# Require 'internal' as the first argument
|
||||||
[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; }
|
[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; }
|
||||||
|
|
||||||
|
@ -25,14 +27,12 @@ cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Strip #error lines from Configuration.h
|
# Strip #error lines from Configuration.h
|
||||||
SED=$(which gsed sed | head -n1)
|
|
||||||
IFS=$'\n'; set -f
|
IFS=$'\n'; set -f
|
||||||
$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h
|
$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h
|
||||||
rm Marlin/Configuration.h~
|
rm Marlin/Configuration.h~
|
||||||
unset IFS; set +f
|
unset IFS; set +f
|
||||||
|
|
||||||
echo "Building the firmware now..."
|
echo "Building the firmware now..."
|
||||||
HERE=`dirname "$0"`
|
|
||||||
$HERE/mftest -s -a -n1 || { echo "Failed"; exit 1; }
|
$HERE/mftest -s -a -n1 || { echo "Failed"; exit 1; }
|
||||||
|
|
||||||
echo "Success"
|
echo "Success"
|
||||||
|
|
22
buildroot/bin/mfutil
Executable file
22
buildroot/bin/mfutil
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# mfutil - check env and define helpers
|
||||||
|
#
|
||||||
|
|
||||||
|
# Check dependencies
|
||||||
|
which curl 1>/dev/null 2>&1 || { echo "curl not found! Please install it."; exit ; }
|
||||||
|
which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; }
|
||||||
|
|
||||||
|
SED=$(command -v gsed 2>/dev/null || command -v sed 2>/dev/null)
|
||||||
|
[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; }
|
||||||
|
|
||||||
|
OPEN=$( which gnome-open xdg-open open | head -n1 )
|
||||||
|
|
||||||
|
SELF=`basename "$0"`
|
||||||
|
HERE=`dirname "$0"`
|
||||||
|
|
||||||
|
# Check if called in the right location
|
||||||
|
[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; }
|
||||||
|
|
||||||
|
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
|
||||||
|
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }
|
Loading…
Add table
Add a link
Reference in a new issue