Script to download & build Configurations (#20992)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
X-Ryl669 2021-02-15 12:48:11 +01:00 committed by GitHub
parent 79ee2fa20a
commit d86910ce94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,62 @@
#!/usr/bin/env bash
echo "This script will attempt to build Marlin for all known configurations."
echo "In case of failure, the current configuration remains in your repository."
echo "To revert to your current version, run 'git checkout -f'."
self=`basename "$0"`
HERE=`dirname "$0"`
# 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 ; }
if [ -z "$1" ]; then
echo ""
echo "ERROR: "
echo " Expected parameter: $self base_branch [resume_point]"
echo " with:"
echo " base_branch The branch in the Configuration repository to use"
echo " resume_point If not empty, resume building from this board"
exit
fi
# Check if called in the right folder
if [ ! -e "Marlin/src" ]; then
echo "This script must be called from the root folder of a Marlin repository, please navigate to this folder and call:"
echo "buildroot/ci-check/$self $1"
exit
fi
# Check if the current repository has unmerged changes
if [ -z "$2" ]; then
git diff --quiet || { echo "Your current repository is not clean. Either commit your change or stash them, and re-run this script"; exit ; }
else
echo "Resuming from $2"
fi
TMPDIR=`mktemp -d`
# Ok, let's do our stuff now
# First extract the current temporary folder
echo "Fetching configuration repository"
if [ ! -e "$TMPDIR/README.md" ]; then
git clone --single-branch --branch "$1" https://github.com/MarlinFirmware/Configurations.git "$TMPDIR" || { echo "Failed to clone the configuration repository"; exit ; }
rm -r $TMPDIR/.git
fi
echo
echo "Start building now..."
echo "====================="
shopt -s nullglob
for config in $TMPDIR/config/examples/*/; do
[ -d "${config}" ] || continue
base=`basename "$config"`
if [ ! -z "$2" ] && [ "$2" != "$base" ]; then
echo "Skipping $base..."
continue
fi
"$HERE/build_example" "internal" "$TMPDIR" "$base" || { echo "Failed to build $base"; exit ; }
done
rm -r "$TMPDIR"

35
buildroot/bin/build_example Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
if [ "$1" != "internal" ]; then
echo "Don't call this script directly, use build_all_examples instead."
exit 1
fi
SED=$(which gsed || which sed)
HERE=`dirname "$0"`
echo "Testing $3:"
shopt -s nullglob
for sub in find $2/config/examples/$3 -type d; do
[[ -d $sub ]] || continue
base=`basename "$sub"`
if [[ ! -f $sub/Configuration.h ]] && [[ ! -f $sub/Configuration_adv.h ]]; then
echo "No configuration files found in $sub"
continue
fi
echo "Getting configuration files from $sub"
cp "$2/config/default"/*.h Marlin/
cp "$sub"/Configuration.h Marlin/ 2>/dev/null
cp "$sub"/Configuration_adv.h Marlin/ 2>/dev/null
cp "$sub"/_Bootscreen.h Marlin/ 2>/dev/null
cp "$sub"/_Statusscreen.h Marlin/ 2>/dev/null
echo "Building the firmware now..."
echo "$HERE/mftest" -a || exit 1
done
echo "Success"
exit 0