@@ -140,9 +140,13 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
140
140
build_dir=" $HOME /.arduino/tests/$sketchname /build.tmp"
141
141
fi
142
142
143
+ echo " Chunk index = $CHUNK_INDEX "
144
+
143
145
log_file=" $HOME /.arduino/cli_compile_output.txt"
144
146
sizes_file=" $GITHUB_WORKSPACE /cli_compile_$CHUNK_INDEX .json"
145
147
148
+ echo " Sizes file = $sizes_file "
149
+
146
150
# echo board,target and start of sketches to sizes_file json
147
151
echo " { \" board\" : \" $fqbn \" ,
148
152
\" target\" : \" $target \" ,
@@ -187,15 +191,15 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
187
191
ram_bytes=$( grep -oE ' Global variables use ([0-9]+) bytes' $log_file | awk ' {print $4}' )
188
192
ram_percentage=$( grep -oE ' Global variables use ([0-9]+) bytes \(([0-9]+)%\)' $log_file | awk ' {print $6}' | tr -d ' (%)' )
189
193
194
+ # Extract the directory path excluding the filename
195
+ directory_path=$( dirname " $sketch " )
196
+ echo " Debug (sketch)- directory path = $directory_path "
190
197
# Define the constant part
191
- constant_path=" $HOME /Arduino/hardware/espressif/esp32/libraries/"
192
-
193
- # Extract the desired substring using awk
194
- lib_sketch_name=$( echo " $sketch " | sed " s|$constant_part \([^/]*\)/.*|\1|" )
195
-
196
- # Print the extracted substring
197
- echo " Extracted Path: $lib_sketch_name "
198
-
198
+ constant_part=" /home/runner/Arduino/hardware/espressif/esp32/libraries/"
199
+ echo " Debug (sketch)- constant part = $constant_part "
200
+ # Extract the desired substring using sed
201
+ lib_sketch_name=$( echo " $directory_path " | sed " s|$constant_part ||" )
202
+ echo " Debug (sketch)- extracted path = $lib_sketch_name "
199
203
# append json file where key is fqbn, sketch name, sizes -> extracted values
200
204
echo " {\" name\" : \" $lib_sketch_name \" ,
201
205
\" sizes\" : {
@@ -206,6 +210,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
206
210
}
207
211
}," >> " $sizes_file "
208
212
# if i is the last index of the loop, remove the last comma
213
+ echo " Debug (sketch)- removing last comma from the last JSON object"
209
214
if [ $i -eq $(( $len - 1 )) ]; then
210
215
sed -i ' $ s/.$//' " $sizes_file "
211
216
fi
0 commit comments