@@ -52,7 +52,7 @@ python -c "$replace_script"
52
52
53
53
if [ " $GITHUB_REPOSITORY " == " espressif/arduino-esp32" ]; then
54
54
echo " Linking Core..."
55
- ln -s $GITHUB_WORKSPACE " $PLATFORMIO_ESP32_PATH "
55
+ ln -s " $GITHUB_WORKSPACE " " $PLATFORMIO_ESP32_PATH "
56
56
else
57
57
echo " Cloning Core Repository ..."
58
58
git clone --recursive https://github.com/espressif/arduino-esp32.git " $PLATFORMIO_ESP32_PATH " > /dev/null 2>&1
61
61
echo " PlatformIO for ESP32 has been installed"
62
62
echo " "
63
63
64
- function build_pio_sketch() { # build_pio_sketch <board> <options> <path-to-ino>
64
+ function build_pio_sketch { # build_pio_sketch <board> <options> <path-to-ino>
65
65
if [ " $# " -lt 3 ]; then
66
66
echo " ERROR: Illegal number of parameters"
67
67
echo " USAGE: build_pio_sketch <board> <options> <path-to-ino>"
@@ -71,13 +71,15 @@ function build_pio_sketch(){ # build_pio_sketch <board> <options> <path-to-ino>
71
71
local board=" $1 "
72
72
local options=" $2 "
73
73
local sketch=" $3 "
74
- local sketch_dir=$( dirname " $sketch " )
74
+ local sketch_dir
75
+
76
+ sketch_dir=$( dirname " $sketch " )
75
77
echo " "
76
- echo " Compiling '" $( basename " $sketch " ) " ' ..."
78
+ echo " Compiling '$( basename " $sketch " ) ' ..."
77
79
python -m platformio ci --board " $board " " $sketch_dir " --project-option=" $options "
78
80
}
79
81
80
- function build_pio_sketches() { # build_pio_sketches <board> <options> <examples-path> <chunk> <total-chunks>
82
+ function build_pio_sketches { # build_pio_sketches <board> <options> <examples-path> <chunk> <total-chunks>
81
83
if [ " $# " -lt 3 ]; then
82
84
echo " ERROR: Illegal number of parameters"
83
85
echo " USAGE: build_pio_sketches <board> <options> <examples-path> [<chunk> <total-chunks>]"
@@ -108,27 +110,34 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
108
110
${COUNT_SKETCHES} " $examples " " esp32"
109
111
local sketchcount=$?
110
112
set -e
111
- local sketches=$( cat sketches.txt)
113
+ local sketches
114
+ sketches=$( cat sketches.txt)
112
115
rm -rf sketches.txt
113
116
114
- local chunk_size=$(( $sketchcount / $chunks_num ))
115
- local all_chunks=$(( $chunks_num * $chunk_size ))
117
+ local chunk_size
118
+ local all_chunks
119
+ local start_index
120
+ local end_index
121
+ local start_num
122
+
123
+ chunk_size=$(( sketchcount / chunks_num ))
124
+ all_chunks=$(( chunks_num * chunk_size ))
116
125
if [ " $all_chunks " -lt " $sketchcount " ]; then
117
- chunk_size=$(( $ chunk_size + 1 ))
126
+ chunk_size=$(( chunk_size + 1 ))
118
127
fi
119
128
120
- local start_index=$(( $ chunk_idex * $ chunk_size ))
129
+ start_index=$(( chunk_idex * chunk_size ))
121
130
if [ " $sketchcount " -le " $start_index " ]; then
122
131
echo " Skipping job"
123
132
return 0
124
133
fi
125
134
126
- local end_index=$(( $(( $ chunk_idex + 1 )) * $ chunk_size ))
135
+ end_index=$(( $(( chunk_idex + 1 )) * chunk_size ))
127
136
if [ " $end_index " -gt " $sketchcount " ]; then
128
137
end_index=$sketchcount
129
138
fi
130
139
131
- local start_num=$(( $ start_index + 1 ))
140
+ start_num=$(( start_index + 1 ))
132
141
echo " Found $sketchcount Sketches" ;
133
142
echo " Chunk Count : $chunks_num "
134
143
echo " Chunk Size : $chunk_size "
@@ -137,25 +146,32 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
137
146
138
147
local sketchnum=0
139
148
for sketch in $sketches ; do
140
- local sketchdir=$( dirname $sketch )
141
- local sketchdirname=$( basename $sketchdir )
142
- local sketchname=$( basename $sketch )
149
+ local sketchdir
150
+ local sketchdirname
151
+ local sketchname
152
+ local is_target
153
+ local has_requirements
154
+
155
+ sketchdir=$( dirname " $sketch " )
156
+ sketchdirname=$( basename " $sketchdir " )
157
+ sketchname=$( basename " $sketch " )
158
+
143
159
if [[ " $sketchdirname .ino" != " $sketchname " ]]; then
144
160
continue
145
- elif [ -f $sketchdir /ci.json ]; then
161
+ elif [ -f " $sketchdir " /ci.json ]; then
146
162
# If the target is listed as false, skip the sketch. Otherwise, include it.
147
- is_target=$( jq -r ' .targets[esp32]' $sketchdir /ci.json)
163
+ is_target=$( jq -r ' .targets[esp32]' " $sketchdir " /ci.json)
148
164
if [[ " $is_target " == " false" ]]; then
149
165
continue
150
166
fi
151
167
152
- local has_requirements=$( ${CHECK_REQUIREMENTS} $sketchdir " $SDKCONFIG_DIR /esp32/sdkconfig" )
168
+ has_requirements=$( ${CHECK_REQUIREMENTS} " $sketchdir " " $SDKCONFIG_DIR /esp32/sdkconfig" )
153
169
if [ " $has_requirements " == " 0" ]; then
154
170
continue
155
171
fi
156
172
fi
157
173
158
- sketchnum=$(( $ sketchnum + 1 ))
174
+ sketchnum=$(( sketchnum + 1 ))
159
175
if [ " $sketchnum " -le " $start_index " ] \
160
176
|| [ " $sketchnum " -gt " $end_index " ]; then
161
177
continue
0 commit comments