Skip to content

Commit 0d93cc7

Browse files
committed
Update sketch_utils.sh
1 parent 8651c52 commit 0d93cc7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

.github/scripts/sketch_utils.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
151151

152152
echo "Sizes file = $sizes_file"
153153

154-
#echo board,target and start of sketches to sizes_file json
155-
echo "{ \"board\": \"$fqbn\",
156-
\"target\": \"$target\",
157-
\"sketches\": [" >> "$sizes_file"
158-
159154
mkdir -p "$ARDUINO_CACHE_DIR"
160155
for i in `seq 0 $(($len - 1))`
161156
do
@@ -213,11 +208,6 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
213208
\"ram_percentage\": $ram_percentage
214209
}
215210
}," >> "$sizes_file"
216-
#if i is the last index of the loop, remove the last comma
217-
echo "Debug (sketch)- removing last comma from the last JSON object"
218-
if [ $i -eq $(($len - 1)) ]; then
219-
sed -i '$ s/.$//' "$sizes_file"
220-
fi
221211

222212
elif [ -f "$ide_path/arduino-builder" ]; then
223213
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
@@ -252,11 +242,6 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
252242
# $xtra_opts "${sketchdir}/${sketchname}.ino"
253243
fi
254244
done
255-
256-
#echo end of sketches sizes_file json
257-
echo "]}" >> "$sizes_file"
258-
#echo end of board sizes_file json
259-
echo "}," >> "$sizes_file"
260245

261246
unset fqbn
262247
unset xtra_opts
@@ -394,6 +379,12 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
394379
echo "Start Sketch: $start_num"
395380
echo "End Sketch : $end_index"
396381

382+
sizes_file="$GITHUB_WORKSPACE/cli_compile_$chunk_index.json"
383+
#echo board,target and start of sketches to sizes_file json
384+
echo "{ \"board\": \"$fqbn\",
385+
\"target\": \"$target\",
386+
\"sketches\": [" >> "$sizes_file"
387+
397388
local sketchnum=0
398389
args+=" -ai $ide_path -au $user_path -i $chunk_index"
399390
for sketch in $sketches; do
@@ -412,6 +403,15 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
412403
return $result
413404
fi
414405
done
406+
echo "Debug (sketch)- removing last comma from the last JSON object"
407+
if [ $i -eq $(($len - 1)) ]; then
408+
sed -i '$ s/.$//' "$sizes_file"
409+
fi
410+
#echo end of sketches sizes_file json
411+
echo "]}" >> "$sizes_file"
412+
#echo end of board sizes_file json
413+
echo "}," >> "$sizes_file"
414+
415415
return 0
416416
}
417417

0 commit comments

Comments
 (0)