mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-09 15:57:50 -06:00
🔨 Improve build scripts
This commit is contained in:
parent
af05b6e482
commit
a9f44e37a9
2 changed files with 33 additions and 23 deletions
|
@ -159,11 +159,12 @@ ENAME=("-name" "marlin_config.json" \
|
||||||
"-o" "-name" "schema.yml")
|
"-o" "-name" "schema.yml")
|
||||||
|
|
||||||
# Possible built firmware names (in the build folder)
|
# Possible built firmware names (in the build folder)
|
||||||
BNAME=("-name" 'firmware*.hex' \
|
BNAME=("-name" "firmware*.hex" \
|
||||||
"-o" "-name" "firmware*.bin" \
|
"-o" "-name" "firmware*.bin" \
|
||||||
"-o" "-name" "project*.bin" \
|
"-o" "-name" "project*.bin" \
|
||||||
"-o" "-name" "Robin*.bin" \
|
"-o" "-name" "Robin*.bin" \
|
||||||
"-o" "-name" "main_*.bin")
|
"-o" "-name" "main_*.bin" \
|
||||||
|
"-o" "-name" "MarlinSimulator*")
|
||||||
|
|
||||||
mkdir -p "$BUILD"
|
mkdir -p "$BUILD"
|
||||||
|
|
||||||
|
@ -171,10 +172,10 @@ mkdir -p "$BUILD"
|
||||||
if [[ $EXPNUM ]]; then
|
if [[ $EXPNUM ]]; then
|
||||||
opt_set CONFIG_EXPORT $EXPNUM
|
opt_set CONFIG_EXPORT $EXPNUM
|
||||||
# Clean up old exports
|
# Clean up old exports
|
||||||
find "$BUILD" \( "${ENAME[@]}" \) -exec rm "{}" \;
|
find "$BUILD" -type f \( "${ENAME[@]}" \) -exec rm "{}" \;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
((ARCHIVE)) && find "$BUILD" \( "${BNAME[@]}" \) -exec rm "{}" \;
|
((ARCHIVE)) && find "$BUILD" -type f \( "${BNAME[@]}" \) -exec rm "{}" \;
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
|
@ -200,7 +201,7 @@ else
|
||||||
if [[ -n $EXPNUM ]]; then
|
if [[ -n $EXPNUM ]]; then
|
||||||
annc "Exporting $EXPNUM"
|
annc "Exporting $EXPNUM"
|
||||||
[[ -f Marlin/Config-export.h ]] && { cp Marlin/Config-export.h "$ARCSUB"/Config.h ; }
|
[[ -f Marlin/Config-export.h ]] && { cp Marlin/Config-export.h "$ARCSUB"/Config.h ; }
|
||||||
find "$BUILD" \( "${ENAME[@]}" \) -exec cp "{}" "$ARCSUB" \;
|
find "$BUILD" -type f \( "${ENAME[@]}" \) -exec cp "{}" "$ARCSUB" \;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy potential firmware files into the config folder
|
# Copy potential firmware files into the config folder
|
||||||
|
@ -208,21 +209,30 @@ else
|
||||||
# Currently only BOARD_CREALITY_F401RE env:STM32F401RE_creality
|
# Currently only BOARD_CREALITY_F401RE env:STM32F401RE_creality
|
||||||
if ((ARCHIVE)); then
|
if ((ARCHIVE)); then
|
||||||
annc "Archiving"
|
annc "Archiving"
|
||||||
rm -f "$ARCSUB"/*.tar.gz "$ARCSUB"/*.sha256.txt
|
find "$BUILD" -type f \( "${BNAME[@]}" \) -exec sh -c '
|
||||||
find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c '
|
ARCSUB="$1" ; CONFIG="$2" ; FILE="$3" ; shift 3
|
||||||
ARCSUB="$1"
|
NAME=${FILE##*/} ; SHRT=${NAME%.*} ; DIR=${FILE%/*}
|
||||||
CONFIG="$2"
|
ZIPX=
|
||||||
shift 2
|
if [[ $CONFIG == *Simulator* ]]; then
|
||||||
for FILE in "$@"; do
|
case $(uname | tr '[:upper:]' '[:lower:]') in
|
||||||
cd "${FILE%/*}"
|
darwin) SUB="macOS" ; ZIPX="-X" ;;
|
||||||
NAME=${FILE##*/}
|
*linux) SUB="Linux" ;;
|
||||||
SHRT=${NAME%.*}
|
win*) SUB="Windows" ;;
|
||||||
SHASUM=$(sha256sum "$NAME" | cut -d" " -f1)
|
msys*) SUB="Windows" ;;
|
||||||
tar -czf "$ARCSUB/$SHRT.tar.gz" "$NAME"
|
cygwin*) SUB="Windows" ;;
|
||||||
echo "$CONFIG\n$SHASUM" > "$ARCSUB/$NAME.sha256.txt"
|
mingw*) SUB="Windows" ;;
|
||||||
rm "$NAME"
|
*) SUB='Unix' ;;
|
||||||
cd - >/dev/null
|
esac
|
||||||
done
|
ARCH=$(uname -m | tr '[:lower:]' '[:upper:]')
|
||||||
|
ARCSUB="$ARCSUB/$SUB-$ARCH"
|
||||||
|
fi
|
||||||
|
mkdir -p "$ARCSUB"
|
||||||
|
rm -f "$ARCSUB"/*.zip "$ARCSUB"/*.sha256.txt
|
||||||
|
cd "$DIR"
|
||||||
|
SHASUM=$(sha256sum "$NAME" | cut -d" " -f1)
|
||||||
|
echo "$CONFIG\n$SHASUM" > "$ARCSUB/$NAME.sha256.txt"
|
||||||
|
zip $ZIPX "$ARCSUB/$SHRT.zip" "$NAME" && rm "$NAME"
|
||||||
|
cd - >/dev/null
|
||||||
' sh "$ARCSUB" "$CONFIG" {} +
|
' sh "$ARCSUB" "$CONFIG" {} +
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -343,14 +343,14 @@ def extract_files(filekey):
|
||||||
# Type is based on the value
|
# Type is based on the value
|
||||||
value_type = \
|
value_type = \
|
||||||
'switch' if val == '' \
|
'switch' if val == '' \
|
||||||
else 'bool' if re.match(r'^(true|false)$', val) \
|
|
||||||
else 'int' if re.match(r'^[-+]?\s*\d+$', val) \
|
else 'int' if re.match(r'^[-+]?\s*\d+$', val) \
|
||||||
else 'ints' if re.match(r'^([-+]?\s*\d+)(\s*,\s*[-+]?\s*\d+)+$', val) \
|
else 'ints' if re.match(r'^([-+]?\s*\d+)(\s*,\s*[-+]?\s*\d+)+$', val) \
|
||||||
else 'floats' if re.match(rf'({flt}(\s*,\s*{flt})+)', val) \
|
else 'floats' if re.match(rf'({flt}(\s*,\s*{flt})+)', val) \
|
||||||
else 'float' if re.match(f'^({flt})$', val) \
|
else 'float' if re.match(f'^({flt})$', val) \
|
||||||
else 'string' if val[0] == '"' \
|
else 'string' if val[0] == '"' \
|
||||||
else 'char' if val[0] == "'" \
|
else 'char' if val[0] == "'" \
|
||||||
else 'state' if re.match(r'^(LOW|HIGH)$', val) \
|
else 'bool' if val in ('true', 'false') \
|
||||||
|
else 'state' if val in ('HIGH', 'LOW') \
|
||||||
else 'enum' if re.match(r'^[A-Za-z0-9_]{3,}$', val) \
|
else 'enum' if re.match(r'^[A-Za-z0-9_]{3,}$', val) \
|
||||||
else 'int[]' if re.match(r'^{\s*[-+]?\s*\d+(\s*,\s*[-+]?\s*\d+)*\s*}$', val) \
|
else 'int[]' if re.match(r'^{\s*[-+]?\s*\d+(\s*,\s*[-+]?\s*\d+)*\s*}$', val) \
|
||||||
else 'float[]' if re.match(r'^{{\s*{flt}(\s*,\s*{flt})*\s*}}$', val) \
|
else 'float[]' if re.match(r'^{{\s*{flt}(\s*,\s*{flt})*\s*}}$', val) \
|
||||||
|
@ -385,7 +385,7 @@ def extract_files(filekey):
|
||||||
units = re.match(r'^\(([^)]+)\)', full_comment)
|
units = re.match(r'^\(([^)]+)\)', full_comment)
|
||||||
if units:
|
if units:
|
||||||
units = units[1]
|
units = units[1]
|
||||||
if units == 's' or units == 'sec': units = 'seconds'
|
if units in ('s', 'sec'): units = 'seconds'
|
||||||
define_info['units'] = units
|
define_info['units'] = units
|
||||||
|
|
||||||
if 'comment' not in define_info or define_info['comment'] == '':
|
if 'comment' not in define_info or define_info['comment'] == '':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue