Browse Source

🔨 Update build/CI scripts

FB4S_WIFI
Scott Lahteine 2 years ago
parent
commit
cee9da6132
  1. 46
      buildroot/bin/build_all_examples
  2. 11
      buildroot/bin/restore_configs
  3. 1
      buildroot/bin/use_example_configs

46
buildroot/bin/build_all_examples

@ -2,14 +2,14 @@
# #
# Usage: # Usage:
# #
# build_all_examples [-b|--branch=<branch>] # build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
# [-c|--continue] # [-c|--continue] - Continue the paused build
# [-d|--debug] # [-d|--debug] - Print extra debug output
# [-i|--ini] # [-i|--ini] - Archive ini/json/yml files in the temp config folder
# [-l|--limit=#] # [-l|--limit=#] - Limit the number of builds in this run
# [-n|--nobuild] # [-n|--nobuild] - Don't actually build anything.
# [-r|--resume=<path>] # [-r|--resume=<path>] - Start at some config in the filesystem order
# [-s|--skip] # [-s|--skip] - Do the thing
# #
# build_all_examples [...] branch [resume-from] # build_all_examples [...] branch [resume-from]
# #
@ -40,7 +40,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;; r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
c) CONTINUE=1 ; bugout "Continue" ;; c) CONTINUE=1 ; bugout "Continue" ;;
s) CONTSKIP=1 ; bugout "Continue, skipping" ;; s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
i) CREATE_INI=1 ; bugout "Generate an INI file" ;; i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
h) EXIT_USAGE=1 ; break ;; h) EXIT_USAGE=1 ; break ;;
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;; l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
d|v) DEBUG=1 ; bugout "Debug ON" ;; d|v) DEBUG=1 ; bugout "Debug ON" ;;
@ -52,7 +52,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
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 build(s)" ;; limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
ini) CREATE_INI=1 ; bugout "Generate an INI file" ;; ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
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" ;;
nobuild) DRYRUN=1 ; bugout "Dry Run" ;; nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
@ -136,19 +136,21 @@ for CONF in $CONF_TREE ; do
# ...if skipping, don't build this one # ...if skipping, don't build this one
compgen -G "${CONF}Con*.h" > /dev/null || continue compgen -G "${CONF}Con*.h" > /dev/null || continue
# Remember where we are in case of failure # Build or print build command for --nobuild
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
# Build or pretend to build
if [[ $DRYRUN ]]; then if [[ $DRYRUN ]]; then
echo "[DRYRUN] build_example internal \"$TMP\" \"$DIR\"" echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
else else
# Build folder is unknown so delete all "config.ini" files # Remember where we are in case of failure
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec rm "{}" \; echo "${BRANCH}*${DIR}" >"$STAT_FILE"
((DEBUG)) && echo "\"$HERE/build_example\" \"internal\" \"$TMP\" \"$DIR\"" # Build folder is unknown so delete all report files
"$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } if [[ $COPY_INI ]]; then
# Build folder is unknown so copy any "config.ini" IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \; $IFIND -exec rm "{}" \;
fi
((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\""
"$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
# Build folder is unknown so copy all report files
[[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \;
fi fi
((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; } ((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
@ -160,7 +162,7 @@ done
# 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 [[ $COPY_INI ]]; then
OPEN=$( which gnome-open xdg-open open | head -n1 ) OPEN=$( which gnome-open xdg-open open | head -n1 )
$OPEN "$TMP" $OPEN "$TMP"
elif [[ ! $PAUSE ]]; then elif [[ ! $PAUSE ]]; then

11
buildroot/bin/restore_configs

@ -1,6 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
git checkout Marlin/Configuration.h 2>/dev/null
git checkout Marlin/Configuration_adv.h 2>/dev/null
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip
if [[ $1 == '-d' || $1 == '--default' ]]; then
use_example_configs
else
git checkout Marlin/Configuration.h 2>/dev/null
git checkout Marlin/Configuration_adv.h 2>/dev/null
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
fi

1
buildroot/bin/use_example_configs

@ -3,6 +3,7 @@
# use_example_configs [repo:]configpath # use_example_configs [repo:]configpath
# #
# Examples: # Examples:
# use_example_configs
# use_example_configs Creality/CR-10/CrealityV1 # use_example_configs Creality/CR-10/CrealityV1
# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1 # use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
# #

Loading…
Cancel
Save