|
@ -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 "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'." |
|
|
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 -c is given start from the last attempted build |
|
|
if [[ $1 == '-c' ]]; then |
|
|
if [[ $1 == '-c' ]]; then |
|
|
if [[ -f "$STAT_FILE" ]]; then |
|
|
if [[ -z $BRANCH || -z $FIRST_CONF ]]; then |
|
|
read BRANCH FIRST_CONF <"$STAT_FILE" |
|
|
|
|
|
else |
|
|
|
|
|
echo "Nothing to continue" |
|
|
echo "Nothing to continue" |
|
|
exit |
|
|
exit |
|
|
fi |
|
|
fi |
|
|
|
|
|
elif [[ $1 == '-s' ]]; then |
|
|
|
|
|
if [[ -n $BRANCH && -n $FIRST_CONF ]]; then |
|
|
|
|
|
SKIP_CONF=1 |
|
|
|
|
|
else |
|
|
|
|
|
echo "Nothing to skip" |
|
|
|
|
|
exit |
|
|
|
|
|
fi |
|
|
else |
|
|
else |
|
|
BRANCH=${1:-"import-2.0.x"} |
|
|
BRANCH=${1:-"import-2.0.x"} |
|
|
FIRST_CONF=$2 |
|
|
FIRST_CONF=$2 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# Check if the current repository has unmerged changes |
|
|
# Check if the current repository has unmerged changes |
|
|
if [[ -z "$FIRST_CONF" ]]; then |
|
|
if [[ $SKIP_CONF ]]; then |
|
|
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } |
|
|
echo "Skipping $FIRST_CONF" |
|
|
else |
|
|
elif [[ $FIRST_CONF ]]; then |
|
|
echo "Resuming from $FIRST_CONF" |
|
|
echo "Resuming from $FIRST_CONF" |
|
|
|
|
|
else |
|
|
|
|
|
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# Create a temporary folder inside .pio |
|
|
# Create a temporary folder inside .pio |
|
@ -67,12 +80,19 @@ 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 |
|
|
DIR=$( echo $CONF | sed "s|$TMP/config/examples/||" ) |
|
|
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 |
|
|
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 |
|
|
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 ; } |
|
|
"$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|