Skip to content

Commit

Permalink
🔨 Fix schema.py ; Add build_example --index=N
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 27, 2024
1 parent 37f490f commit 2b39e51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions buildroot/bin/build_example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
# -c|--config=<rel> - Sub-path of the configs to build (within config/examples)
# [-n|--index=N] - Which environment to build, by index (Based on pins.h comments)
# [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
# [-a|--archive] - Archive the build (to the export location)
# [-o|--output] - Redirect export / archiving to another location
Expand All @@ -19,6 +20,7 @@ usage() { echo "Usage:
build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
-c|--config=<rel> - Sub-path of the configs to build (within config/examples)
[-n|--index=N] - Which environment to build, by index (Based on pins.h comments)
[-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
[-a|--archive] - Archive the build (to the export location)
[-o|--output] - Redirect export / archiving to another location
Expand Down Expand Up @@ -50,12 +52,14 @@ REVEAL=
EXPNUM=
NOFAIL=
OUTBASE=
while getopts 'ab:c:e:fhio:r-:' OFLAG; do
BUILDINDEX=1
while getopts 'ab:c:e:fhin:o:r-:' OFLAG; do
case "${OFLAG}" in
a) ARCHIVE=1 ;;
b) BASE="${OPTARG%/}" ;;
c) CONFIG="${OPTARG%/}" ;;
e) EXPNUM="$OPTARG" ;;
n) BUILDINDEX="$OPTARG" ;;
o) OUTBASE="${OPTARG%/}" ;;
h) EXIT_USAGE=1 ; break ;;
f) NOFAIL=1 ;;
Expand All @@ -66,6 +70,7 @@ while getopts 'ab:c:e:fhio:r-:' OFLAG; do
allow) ALLOW=1 ;;
base) BASE="${OVAL%/}" ;;
config) CONFIG="${OVAL%/}" ;;
index) BUILDINDEX="$OVAL" ;;
export) EXPNUM="$OVAL" ;;
output) OUTBASE="${OVAL%/}" ;;
help) EXIT_USAGE=1 ; break ;;
Expand Down Expand Up @@ -174,7 +179,7 @@ fi
set +e

echo "Building example $CONFIG ..."
mftest -s -a -n1 ; ERR=$?
mftest -s -a -n$BUILDINDEX ; ERR=$?

((ERR)) && alrt "Failed ($ERR)" || annc "Success"

Expand Down
3 changes: 1 addition & 2 deletions buildroot/share/PlatformIO/scripts/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ class Parse:
comment_buff = []
if cline != '':
# A (block or slash) comment was already added
if 'comment' in last_added_ref:
cfield = 'notes'
cfield = 'notes' if 'comment' in last_added_ref else 'comment'
last_added_ref[cfield] = cline

#
Expand Down

0 comments on commit 2b39e51

Please sign in to comment.