@@ -121,33 +121,61 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
121
121
if [ -n " $ARDUINO_BUILD_DIR " ]; then
122
122
build_dir=" $ARDUINO_BUILD_DIR "
123
123
elif [ $len -eq 1 ]; then
124
- build_dir=" $sketchdir /build"
124
+ # build_dir="$sketchdir/build"
125
+ build_dir=" $HOME /.arduino/build.tmp"
125
126
fi
126
127
127
128
mkdir -p " $ARDUINO_CACHE_DIR "
128
129
for i in ` seq 0 $(( $len - 1 )) `
129
130
do
130
131
if [ $len -ne 1 ]; then
131
- build_dir=" $sketchdir /build$i "
132
+ # build_dir="$sketchdir/build$i"
133
+ build_dir=" $HOME /.arduino/build$i .tmp"
132
134
fi
133
135
rm -rf $build_dir
134
136
mkdir -p $build_dir
135
137
136
138
currfqbn=` echo $fqbn | jq -r --argjson i $i ' .[$i]' `
137
139
sketchname=$( basename $sketchdir )
138
- echo " Building $sketchname with FQBN=$currfqbn "
139
- $ide_path /arduino-builder -compile -logger=human -core-api-version=10810 \
140
- -fqbn=\" $currfqbn \" \
141
- -warnings=" all" \
142
- -tools " $ide_path /tools-builder" \
143
- -tools " $ide_path /tools" \
144
- -built-in-libraries " $ide_path /libraries" \
145
- -hardware " $ide_path /hardware" \
146
- -hardware " $user_path /hardware" \
147
- -libraries " $user_path /libraries" \
148
- -build-cache " $ARDUINO_CACHE_DIR " \
149
- -build-path " $build_dir " \
150
- $xtra_opts " ${sketchdir} /${sketchname} .ino"
140
+
141
+ if [ -f " $ide_path /arduino-cli" ]; then
142
+ echo " Building $sketchname with arduino-cli and FQBN=$currfqbn "
143
+
144
+ curroptions=` echo " $currfqbn " | cut -d' :' -f4`
145
+ currfqbn=` echo " $currfqbn " | cut -d' :' -f1-3`
146
+ $ide_path /arduino-cli compile \
147
+ --fqbn " $currfqbn " \
148
+ --board-options " $curroptions " \
149
+ --warnings " all" \
150
+ --build-cache-path " $ARDUINO_CACHE_DIR " \
151
+ --build-path " $build_dir " \
152
+ $xtra_opts " ${sketchdir} "
153
+ elif [ -f " $ide_path /arduino-builder" ]; then
154
+ echo " Building $sketchname with arduino-builder and FQBN=$currfqbn "
155
+
156
+ $ide_path /arduino-builder -compile -logger=human -core-api-version=10810 \
157
+ -fqbn=\" $currfqbn \" \
158
+ -warnings=" all" \
159
+ -tools " $ide_path /tools-builder" \
160
+ -hardware " $user_path /hardware" \
161
+ -libraries " $user_path /libraries" \
162
+ -build-cache " $ARDUINO_CACHE_DIR " \
163
+ -build-path " $build_dir " \
164
+ $xtra_opts " ${sketchdir} /${sketchname} .ino"
165
+
166
+ # $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
167
+ # -fqbn=\"$currfqbn\" \
168
+ # -warnings="all" \
169
+ # -tools "$ide_path/tools-builder" \
170
+ # -tools "$ide_path/tools" \
171
+ # -built-in-libraries "$ide_path/libraries" \
172
+ # -hardware "$ide_path/hardware" \
173
+ # -hardware "$user_path/hardware" \
174
+ # -libraries "$user_path/libraries" \
175
+ # -build-cache "$ARDUINO_CACHE_DIR" \
176
+ # -build-path "$build_dir" \
177
+ # $xtra_opts "${sketchdir}/${sketchname}.ino"
178
+ fi
151
179
done
152
180
}
153
181
0 commit comments