2018-06-24 14:59:16 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This script is for Travis. It checks all non-examples source files in libraries/ and cores/ are listed in
|
|
|
|
# CMakeLists.txt for the cmake-based IDF component
|
|
|
|
#
|
|
|
|
# If you see an error running this script, edit CMakeLists.txt and add any new source files into your PR
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-08-20 14:32:47 +02:00
|
|
|
# pull all submodules
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
2018-06-24 14:59:16 +02:00
|
|
|
# find all source files in repo
|
2018-11-27 18:50:09 +01:00
|
|
|
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
|
2018-06-24 14:59:16 +02:00
|
|
|
|
|
|
|
# find all source files named in CMakeLists.txt COMPONENT_SRCS
|
2021-04-05 13:23:58 +02:00
|
|
|
CMAKE_SRCS=`cmake --trace-expand -C CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort`
|
2018-06-24 14:59:16 +02:00
|
|
|
|
2021-04-05 13:23:58 +02:00
|
|
|
if ! diff -u0 --label "Repo Files" --label "srcs" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
|
2018-06-24 14:59:16 +02:00
|
|
|
echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match"
|
|
|
|
echo "Edit CMakeLists.txt as appropriate to add/remove source files from COMPONENT_SRCS"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "CMakeLists.txt and repo source files match"
|
|
|
|
exit 0
|