3 CMAKE=${CMAKE:-$(which cmake)}
5 $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
6 $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
8 # Find compiler warnings
9 awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log \
10 | grep -v "CMake" | tee buildErrors.log || true
11 grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
13 # Find linking errors:
14 grep "^/usr/bin/ld:" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
17 $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
19 # Fail if there were warnings or errors reported
20 if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
21 # Remove object files to minimize artifact size
22 find . -mindepth 1 -name '*.o' ! -type l -printf '%p\n' -delete 2>&1 > remove-build-objects.log