@@ -109,18 +109,30 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
109
109
exit 1
110
110
fi
111
111
112
+ # The directory that will hold all the artifcats (the build directory) is
113
+ # provided through:
114
+ # 1. An env variable called ARDUINO_BUILD_DIR.
115
+ # 2. Created at the sketch level as "build" in the case of a single
116
+ # configuration test.
117
+ # 3. Created at the sketch level as "buildX" where X is the number
118
+ # of configuration built in case of a multiconfiguration test.
119
+
112
120
ARDUINO_CACHE_DIR=" $HOME /.arduino/cache.tmp"
113
- if [ -z " $ARDUINO_BUILD_DIR " ]; then
114
- build_dir=" $sketchdir /build"
115
- else
121
+ if [ -n " $ARDUINO_BUILD_DIR " ]; then
116
122
build_dir=" $ARDUINO_BUILD_DIR "
123
+ elif [ $len -eq 1 ]; then
124
+ build_dir=" $sketchdir /build"
117
125
fi
118
126
119
127
mkdir -p " $ARDUINO_CACHE_DIR "
120
128
for i in ` seq 0 $(( $len - 1 )) `
121
129
do
122
- rm -rf " $build_dir$i "
123
- mkdir -p " $build_dir$i "
130
+ if [ $len -ne 1 ]; then
131
+ build_dir=" $sketchdir /build$i "
132
+ fi
133
+ rm -rf $build_dir
134
+ mkdir -p $build_dir
135
+
124
136
currfqbn=` echo $fqbn | jq -r --argjson i $i ' .[$i]' `
125
137
sketchname=$( basename $sketchdir )
126
138
echo " Building $sketchname with FQBN=$currfqbn "
@@ -134,7 +146,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
134
146
-hardware " $user_path /hardware" \
135
147
-libraries " $user_path /libraries" \
136
148
-build-cache " $ARDUINO_CACHE_DIR " \
137
- -build-path " $build_dir$i " \
149
+ -build-path " $build_dir " \
138
150
$xtra_opts " ${sketchdir} /${sketchname} .ino"
139
151
done
140
152
}
0 commit comments