Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Further script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 29, 2022
1 parent dc3322b commit 889d122
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
46 changes: 24 additions & 22 deletions buildroot/bin/build_all_examples
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# Usage:
#
# build_all_examples [-b|--branch=<branch>]
# [-c|--continue]
# [-d|--debug]
# [-i|--ini]
# [-l|--limit=#]
# [-n|--nobuild]
# [-r|--resume=<path>]
# [-s|--skip]
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
# [-c|--continue] - Continue the paused build
# [-d|--debug] - Print extra debug output
# [-i|--ini] - Archive ini/json/yml files in the temp config folder
# [-l|--limit=#] - Limit the number of builds in this run
# [-n|--nobuild] - Don't actually build anything.
# [-r|--resume=<path>] - Start at some config in the filesystem order
# [-s|--skip] - Do the thing
#
# build_all_examples [...] branch [resume-from]
#
Expand Down Expand Up @@ -40,7 +40,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
c) CONTINUE=1 ; bugout "Continue" ;;
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 ;;
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
d|v) DEBUG=1 ; bugout "Debug ON" ;;
Expand All @@ -52,7 +52,7 @@ while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
continue) CONTINUE=1 ; bugout "Continue" ;;
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
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 ;;
debug) DEBUG=1 ; bugout "Debug ON" ;;
nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
Expand Down Expand Up @@ -136,19 +136,21 @@ for CONF in $CONF_TREE ; do
# ...if skipping, don't build this one
compgen -G "${CONF}Con*.h" > /dev/null || continue

# Remember where we are in case of failure
echo "${BRANCH}*${DIR}" >"$STAT_FILE"

# Build or pretend to build
# Build or print build command for --nobuild
if [[ $DRYRUN ]]; then
echo "[DRYRUN] build_example internal \"$TMP\" \"$DIR\""
echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
else
# Build folder is unknown so delete all "config.ini" files
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec rm "{}" \;
((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 any "config.ini"
[[ $CREATE_INI ]] && find ./.pio/build/ -name "config.ini" -exec cp "{}" "$CONF" \;
# Remember where we are in case of failure
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
# Build folder is unknown so delete all report files
if [[ $COPY_INI ]]; then
IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
$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

((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
Expand All @@ -160,7 +162,7 @@ done

# Delete the temp folder if not preserving generated INI files
if [[ -e "$TMP/config/examples" ]]; then
if [[ $CREATE_INI ]]; then
if [[ $COPY_INI ]]; then
OPEN=$( which gnome-open xdg-open open | head -n1 )
$OPEN "$TMP"
elif [[ ! $PAUSE ]]; then
Expand Down
1 change: 1 addition & 0 deletions buildroot/bin/use_example_configs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# use_example_configs [repo:]configpath
#
# Examples:
# use_example_configs
# use_example_configs Creality/CR-10/CrealityV1
# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
#
Expand Down

0 comments on commit 889d122

Please sign in to comment.