@@ -12,14 +12,19 @@ function check_requirements(){ # check_requirements <sketchdir> <sdkconfig_path>
12
12
local sketchdir=$1
13
13
local sdkconfig_path=$2
14
14
15
+ if [ ! -f " $sdkconfig_path " ] || [ ! -f " $sketchdir /ci.json" ]; then
16
+ echo " ERROR: sdkconfig or ci.json not found"
17
+ exit 1
18
+ fi
19
+
15
20
# Check if the sketch requires any configuration options (AND)
16
21
local requirements=$( jq -r ' .requires[]? // empty' " $sketchdir /ci.json" )
17
22
if [[ " $requirements " != " null" && " $requirements " != " " ]]; then
18
23
for requirement in $requirements ; do
19
24
requirement=$( echo $requirement | xargs)
20
25
found_line=$( grep -E " ^$requirement " " $sdkconfig_path " )
21
26
if [[ " $found_line " == " " ]]; then
22
- return 0
27
+ echo 0
23
28
fi
24
29
done
25
30
fi
@@ -37,11 +42,11 @@ function check_requirements(){ # check_requirements <sketchdir> <sdkconfig_path>
37
42
fi
38
43
done
39
44
if [[ " $found " == " false" ]]; then
40
- return 0
45
+ echo 0
41
46
fi
42
47
fi
43
48
44
- return 1
49
+ echo 1
45
50
}
46
51
47
52
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
@@ -207,7 +212,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
207
212
exit 0
208
213
fi
209
214
210
- if ! check_requirements " $sketchdir " " $SDKCONFIG_DIR /$target /sdkconfig" ; then
215
+ if [ $( check_requirements " $sketchdir " " $SDKCONFIG_DIR /$target /sdkconfig" ) -eq 0 ] ; then
211
216
echo " Target $target does not meet the requirements for $sketchname . Skipping."
212
217
exit 0
213
218
fi
@@ -358,7 +363,7 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
358
363
fi
359
364
360
365
if [ " $ignore_requirements " != " 1" ]; then
361
- if ! check_requirements " $sketchdir " " $SDKCONFIG_DIR /$target /sdkconfig" ; then
366
+ if [ $( check_requirements " $sketchdir " " $SDKCONFIG_DIR /$target /sdkconfig" ) -eq 0 ] ; then
362
367
continue
363
368
fi
364
369
fi
0 commit comments