Skip to content

Commit 4a6871a

Browse files
committed
✨ Supporting files updates
1 parent 5037f37 commit 4a6871a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1180
-819
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ vc-fileutils.settings
125125
# Visual Studio Code
126126
.vscode/*
127127
!.vscode/extensions.json
128+
*.code-workspace
128129

129130
# Simulation files
130131
imgui.ini

.zed/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Marlin-specific settings for Zed
3+
*
4+
* For a full list of overridable settings, and general information on folder-specific settings,
5+
* see the documentation: https://zed.dev/docs/configuring-zed#settings-files
6+
*/
7+
{
8+
"languages": {
9+
"C": {
10+
"enable_language_server": false
11+
},
12+
"C++": {
13+
"enable_language_server": false
14+
}
15+
}
16+
}

Marlin/src/HAL/DUE/upload_extra_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
if current_OS == 'Windows':
1313

14-
Import("env")
14+
env = pioutil.env
1515

1616
# Use bossac.exe on Windows
1717
env.Replace(

buildroot/bin/__init__.py

Whitespace-only changes.

buildroot/bin/build_all_examples

Lines changed: 126 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,48 @@
22
#
33
# Usage:
44
#
5-
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
5+
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
6+
# [-B|--base] - Base path of configurations, overriding -b
67
# [-c|--continue] - Continue the paused build
7-
# [-d|--debug] - Print extra debug output
8-
# [-i|--ini] - Archive ini/json/yml files in the temp config folder
9-
# [-l|--limit=#] - Limit the number of builds in this run
10-
# [-n|--nobuild] - Don't actually build anything.
8+
# [-p|--purge] - Purge the status file and start over
9+
# [-s|--skip] - Continue the paused build, skipping one
1110
# [-r|--resume=<path>] - Start at some config in the filesystem order
12-
# [-s|--skip] - Do the thing
13-
#
14-
# build_all_examples [...] branch [resume-from]
11+
# [-l|--limit=#] - Limit the number of builds in this run
12+
# [-d|--debug] - Print extra debug output (after)
13+
# [-n|--nobuild] - Don't actually build anything
14+
# [-f|--nofail] - Don't stop on a failed build
15+
# [-e|--export=N] - Set CONFIG_EXPORT and export into each config folder
16+
# [-a|--archive] - Copy the binary to the export location
17+
# [-o|--output] - Redirect export / archiving to another location
18+
# (By default export to origin config folders)
19+
# [-h|--help] - Print usage and exit
1520
#
1621

1722
HERE=`dirname $0`
23+
PATH="$HERE:$PATH"
1824

19-
. "$HERE/mfutil"
25+
. mfutil
2026

2127
GITREPO=https://github.com/MarlinFirmware/Configurations.git
2228
STAT_FILE=./.pio/.buildall
2329

24-
usage() { echo "
25-
Usage: $SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-r|--resume=<path>]
26-
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-c|--continue]
27-
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-s|--skip]
28-
$SELF [-b|--branch=<branch>] [-d|--debug] [-n|--nobuild]
29-
$SELF [...] branch [resume-point]
30+
usage() { echo "Usage:
31+
32+
build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
33+
[-B|--base] - Base path of configurations, overriding -b
34+
[-c|--continue] - Continue the paused build
35+
[-p|--purge] - Purge the status file and start over
36+
[-s|--skip] - Continue the paused build, skipping one
37+
[-r|--resume=<path>] - Start at some config in the filesystem order
38+
[-e|--export=N] - Set CONFIG_EXPORT and export to the export location
39+
[-a|--archive] - Copy the binary to the export location
40+
[-o|--output] - Redirect export / archiving to another location
41+
(By default export to origin config folders)
42+
[-d|--debug] - Print extra debug output (after)
43+
[-l|--limit=#] - Limit the number of builds in this run
44+
[-n|--nobuild] - Don't actually build anything
45+
[-f|--nofail] - Don't stop on a failed build
46+
[-h|--help] - Print usage and exit
3047
"
3148
}
3249

@@ -36,50 +53,60 @@ unset FIRST_CONF
3653
EXIT_USAGE=
3754
LIMIT=1000
3855

39-
while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
56+
while getopts 'aB:b:ce:fdhl:no:pr:sv-:' OFLAG; do
4057
case "${OFLAG}" in
41-
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
42-
r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
43-
c) CONTINUE=1 ; bugout "Continue" ;;
44-
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
45-
i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
58+
a) ARCHIVE=1 ; bugout "Archiving" ;;
59+
B) CBASE=${OPTARG%/} ; bugout "Base: $CBASE" ;;
60+
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
61+
f) NOFAIL=1 ; bugout "Continue on Fail" ;;
62+
r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;;
63+
c) CONTINUE=1 ; bugout "Continue" ;;
64+
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
65+
e) CEXPORT=$OPTARG ; bugout "Export $CEXPORT" ;;
66+
o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;;
4667
h) EXIT_USAGE=1 ; break ;;
47-
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
48-
d|v) DEBUG=1 ; bugout "Debug ON" ;;
49-
n) DRYRUN=1 ; bugout "Dry Run" ;;
50-
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
68+
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
69+
d|v) DEBUG=1 ; bugout "Debug ON" ;;
70+
n) DRYRUN=1 ; bugout "Dry Run" ;;
71+
p) PURGE=1 ; bugout "Purge stat file" ;;
72+
-) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}"
5173
case "$ONAM" in
52-
branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;;
53-
resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;;
54-
continue) CONTINUE=1 ; bugout "Continue" ;;
55-
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
56-
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
57-
ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
74+
archive) ARCHIVE=1 ; bugout "Archiving" ;;
75+
base) CBASE=${OVAL%/} ; bugout "Base: $CBASE" ;;
76+
branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;;
77+
nofail) NOFAIL=1 ; bugout "Continue on Fail" ;;
78+
resume) ISRES=1 ; FIRST_CONF=$OVAL ; bugout "Resume: $FIRST_CONF" ;;
79+
continue) CONTINUE=1 ; bugout "Continue" ;;
80+
skip) CONTSKIP=1 ; bugout "Continue, skipping" ;;
81+
export) CEXPORT=$OVAL ; bugout "Export $EXPORT" ;;
82+
output) OUTBASE="${OVAL%/}" ; bugout "Archive to $OUTBASE" ;;
83+
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
5884
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
59-
debug) DEBUG=1 ; bugout "Debug ON" ;;
60-
nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
85+
debug) DEBUG=1 ; bugout "Debug ON" ;;
86+
nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
87+
purge) PURGE=1 ; bugout "Purge stat file" ;;
6188
*) EXIT_USAGE=2 ; echo "$SELF: unrecognized option \`--$ONAM'" ; break ;;
6289
esac
6390
;;
6491
*) EXIT_USAGE=2 ; break ;;
6592
esac
6693
done
67-
68-
# Extra arguments count as BRANCH, FIRST_CONF
6994
shift $((OPTIND - 1))
70-
[[ $# > 0 ]] && { BRANCH=$1 ; shift 1 ; bugout "BRANCH=$BRANCH" ; }
71-
[[ $# > 0 ]] && { FIRST_CONF=$1 ; shift 1 ; bugout "FIRST_CONF=$FIRST_CONF" ; }
72-
[[ $# > 0 ]] && { EXIT_USAGE=2 ; echo "too many arguments" ; }
7395

96+
# Check for mixed continue, skip, resume arguments. Only one should be used.
97+
((CONTINUE + CONTSKIP + ISRES + PURGE > 1)) && { echo "Don't mix -c, -p, -s, and -r options" ; echo ; EXIT_USAGE=2 ; }
98+
99+
# Exit with helpful usage information
74100
((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; }
75101

76-
echo "This script downloads each Configuration and attempts to build it."
77-
echo "On failure the last-built configs will be left in your working copy."
102+
echo
103+
echo "This script downloads all example configs and attempts to build them."
104+
echo "On failure the last-built configs are left in your working copy."
78105
echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'."
106+
echo
79107

80-
if [[ -f "$STAT_FILE" ]]; then
81-
IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE"
82-
fi
108+
[[ -n $PURGE ]] && rm -f "$STAT_FILE"
109+
[[ -z $FIRST_CONF && -f "$STAT_FILE" ]] && IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE"
83110

84111
# If -c is given start from the last attempted build
85112
if ((CONTINUE)); then
@@ -97,77 +124,90 @@ elif ((CONTSKIP)); then
97124
fi
98125

99126
# Check if the current repository has unmerged changes
100-
if [[ $SKIP_CONF ]]; then
127+
if ((SKIP_CONF)); then
101128
echo "Skipping $FIRST_CONF"
102-
elif [[ $FIRST_CONF ]]; then
129+
elif [[ -n $FIRST_CONF ]]; then
103130
echo "Resuming from $FIRST_CONF"
104131
else
105132
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; }
106133
fi
107134

108-
# Create a temporary folder inside .pio
109-
TMP=./.pio/build-$BRANCH
110-
[[ -d "$TMP" ]] || mkdir -p $TMP
111-
112-
# Download Configurations into the temporary folder
113-
if [[ ! -e "$TMP/README.md" ]]; then
114-
echo "Fetching Configurations from GitHub to $TMP"
115-
git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$TMP" || { echo "Failed to clone the configuration repository"; exit ; }
135+
# Check for the given base path
136+
if [[ -n $CBASE ]]; then
137+
CBASE="${CBASE/#\~/$HOME}"
138+
[[ -d "$CBASE" ]] || { echo "Given base -B $CBASE not found." ; exit ; }
116139
else
117-
echo "Using cached Configurations at $TMP"
140+
# Make a Configurations temporary folder if needed
141+
CBASE=./.pio/build-$BRANCH
142+
[[ -d "$CBASE" ]] || mkdir -p "$CBASE"
143+
# Download the specified Configurations branch if needed
144+
if [[ ! -e "$CBASE/README.md" ]]; then
145+
echo "Fetching Configurations from GitHub to $CBASE"
146+
git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$CBASE" || { echo "Failed to clone the configuration repository"; exit ; }
147+
fi
118148
fi
119149

120-
echo -e "Start build...\n====================="
150+
# Build
151+
echo -e "=====================\nProceed with builds...\n====================="
121152
shopt -s nullglob
122-
IFS='
123-
'
124-
CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" )
125-
for CONF in $CONF_TREE ; do
153+
154+
export PAUSE=1
155+
156+
# Get a list of all folders that contain a file matching "Configuration*.h"
157+
find -ds "$CBASE"/config/examples -type d -name 'Configuration.h' -o -name 'Configuration_adv.h' -print0 | while IFS= read -r -d $'\0' CONF; do
158+
159+
# Remove the file name and slash from the end of the path
160+
CONF=${CONF%/*}
126161

127162
# Get a config's directory name
128-
DIR=$( echo $CONF | "$SED" "s|$TMP/config/examples/||" )
163+
DIR=${CONF#$CBASE/config/examples/}
129164

130165
# If looking for a config, skip others
131-
[[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue
166+
[[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && { ((DEBUG)) && echo "[SKIP] $DIR" ; continue ; }
132167
# Once found, stop looking
133168
unset FIRST_CONF
134169

135170
# If skipping, don't build the found one
136171
[[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; }
137172

138-
# ...if skipping, don't build this one
139-
compgen -G "${CONF}Con*.h" > /dev/null || continue
173+
# Either Configuration.h or Configuration_adv.h must exist
174+
[[ -f "$CONF"/Configuration.h || -f "$CONF"/Configuration_adv.h ]] || { echo "[NONE] $DIR" ; continue ; }
175+
176+
# Command arguments for 'build_example'
177+
CARGS=("-b" "$CBASE" "-c" "$DIR")
178+
179+
# Exporting? Add -e argument
180+
((CEXPORT)) && CARGS+=("-e" "$CEXPORT")
181+
182+
# Continue on fail? Add -f argument
183+
((NOFAIL)) && CARGS+=("-f")
184+
185+
# Archive the build? Add -a argument
186+
((ARCHIVE)) && CARGS+=("-a")
187+
188+
# Redirecting the export/archive output? Add -o argument
189+
[[ -n $OUTBASE ]] && CARGS+=("-o" "$OUTBASE")
140190

141191
# Build or print build command for --nobuild
142-
if [[ $DRYRUN ]]; then
143-
echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
192+
if ((DRYRUN)); then
193+
echo -e "\033[0;32m[DRYRUN] build_example ${CARGS[@]}\033[0m"
144194
else
145195
# Remember where we are in case of failure
146196
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
147-
# Build folder is unknown so delete all report files
148-
if [[ $COPY_INI ]]; then
149-
IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
150-
$IFIND -exec rm "{}" \;
151-
fi
152-
((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\""
153-
"$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
154-
# Build folder is unknown so copy all report files
155-
[[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \;
197+
((DEBUG)) && echo "build_example ${CARGS[@]}"
198+
# Invoke build_example
199+
build_example "${CARGS[@]}" || { echo "Failed to build $DIR" ; exit ; }
156200
fi
157201

158-
((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
202+
echo
203+
((--LIMIT)) || { echo "Specified limit reached" ; break ; }
204+
echo
205+
206+
export PAUSE=0
159207

160208
done
161209

210+
echo "Exiting"
211+
162212
# Delete the build state if not paused early
163-
[[ $PAUSE ]] || rm "$STAT_FILE"
164-
165-
# Delete the temp folder if not preserving generated INI files
166-
if [[ -e "$TMP/config/examples" ]]; then
167-
if [[ $COPY_INI ]]; then
168-
OPEN=$( which gnome-open xdg-open open | head -n1 )
169-
$OPEN "$TMP"
170-
elif [[ ! $PAUSE ]]; then
171-
rm -rf "$TMP"
172-
fi
173-
fi
213+
((PAUSE)) || rm -f "$STAT_FILE"

0 commit comments

Comments
 (0)