Skip to content

Commit 8ccd6ce

Browse files
committed
travis: Check CMakeLists.txt contents match repo source files
1 parent c11d36b commit 8ccd6ce

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Diff for: .travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ script:
4646
- "python -c \"import glob,os,subprocess,sys; map(lambda p: (sys.stdout.write('Library example: %s\\n' % p), subprocess.call(['pio', 'ci', p, '--board', 'esp32dev'])), set([os.path.dirname(p) for p in glob.glob('libraries/*/examples/*/*.ino') + glob.glob('libraries/*/examples/*/*/*.ino')]))\""
4747
- echo -e "travis_fold:end:platformio_test"
4848

49+
- tools/check_cmakelists.sh
50+
4951
notifications:
5052
email:
5153
on_success: change

Diff for: tools/check_cmakelists.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
#
3+
# This script is for Travis. It checks all non-examples source files in libraries/ and cores/ are listed in
4+
# CMakeLists.txt for the cmake-based IDF component
5+
#
6+
# If you see an error running this script, edit CMakeLists.txt and add any new source files into your PR
7+
#
8+
9+
set -e
10+
11+
cd "`dirname $0`/.." # cd to arduino-esp32 root
12+
13+
# find all source files in repo
14+
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name 'main.cpp' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
15+
16+
# find all source files named in CMakeLists.txt COMPONENT_SRCS
17+
CMAKE_SRCS=`cmake --trace-expand -C CMakeLists.txt 2>&1 | grep COMPONENT_SRCS | sed 's/.\+COMPONENT_SRCS //' | sed 's/ )//' | tr ' ' '\n' | sort`
18+
19+
if ! diff -u0 --label "Repo Files" --label "COMPONENT_SRCS" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
20+
echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match"
21+
echo "Edit CMakeLists.txt as appropriate to add/remove source files from COMPONENT_SRCS"
22+
exit 1
23+
fi
24+
25+
echo "CMakeLists.txt and repo source files match"
26+
exit 0

0 commit comments

Comments
 (0)