Files
ESPAsyncWebServer/travis/common.sh
T

40 lines
1.2 KiB
Bash
Raw Normal View History

2016-02-01 18:00:53 +02:00
#!/bin/bash
function build_sketches()
{
2019-06-22 17:38:31 +02:00
#set +e
2016-02-01 18:00:53 +02:00
local arduino=$1
2016-02-01 18:07:24 +02:00
local srcpath=$2
2019-06-22 17:38:31 +02:00
local build_arg=$3
local build_dir=build.tmp
mkdir -p $build_dir
local build_cmd="python travis/build.py -b esp32 -k -p $PWD/$build_dir $build_arg "
2016-02-01 18:00:53 +02:00
local sketches=$(find $srcpath -name *.ino)
2019-06-22 17:38:31 +02:00
export ARDUINO_IDE_PATH=$arduino
2016-02-01 18:00:53 +02:00
for sketch in $sketches; do
2019-06-22 17:38:31 +02:00
rm -rf $build_dir/*
2016-02-01 19:27:08 +02:00
local sketchdir=$(dirname $sketch)
2019-06-22 17:38:31 +02:00
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
echo "Skipping $sketch, beacause it is not the main sketch file";
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
echo -e "\n ------------ Skipping $sketch ------------ \n";
2016-02-01 19:27:08 +02:00
continue
fi
2019-06-22 17:38:31 +02:00
echo -e "\n ------------ Building $sketch ------------ \n";
time ($build_cmd $sketch >$build_dir/build.log)
2016-02-01 18:00:53 +02:00
local result=$?
if [ $result -ne 0 ]; then
echo "Build failed ($1)"
2019-06-22 17:38:31 +02:00
echo "Build log:"
cat $build_dir/build.log
2016-02-01 18:00:53 +02:00
return $result
fi
2019-06-22 17:38:31 +02:00
rm $build_dir/build.log
2016-02-01 18:00:53 +02:00
done
2019-06-22 17:38:31 +02:00
#set -e
2016-02-01 18:00:53 +02:00
}