Skip to content

Commit

Permalink
Add Include what you use (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Jul 5, 2023
1 parent 60794ac commit 5466c5b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
22 changes: 18 additions & 4 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ mkdir -p "${BUILD_DIR}"
[ -z "${PLUGIN_DIR}" ] && export PLUGIN_DIR=$HOME/plugin
mkdir -p "${PLUGIN_DIR}"

IWYU=""
MAKE_COMMAND="make -k -j \$(nproc)"
if [[ "${CXX}" == *clang* ]]; then
MAKE_COMMAND="make -k CXX=include-what-you-use CXXFLAGS=\"-Xiwyu --error_always\" -j \$(nproc)"
IWYU="-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=iwyu"
fi

echo "make command: ${MAKE_COMMAND}"
echo "IWYU option: ${IWYU}"

BAZEL_OPTIONS_DEFAULT="--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_TEST --copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW"
BAZEL_OPTIONS="--cxxopt=-std=c++14 $BAZEL_OPTIONS_DEFAULT"

Expand Down Expand Up @@ -107,8 +117,9 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
-DWITH_ASYNC_EXPORT_PREVIEW=OFF \
-DOTELCPP_MAINTAINER_MODE=ON \
-DWITH_NO_DEPRECATED_CODE=ON \
${IWYU} \
"${SRC_DIR}"
make -k
eval "$MAKE_COMMAND"
make test
exit 0
elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
Expand All @@ -129,8 +140,9 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DOTELCPP_MAINTAINER_MODE=ON \
-DWITH_NO_DEPRECATED_CODE=ON \
${IWYU} \
"${SRC_DIR}"
make -k -j $(nproc)
eval "$MAKE_COMMAND"
make test
exit 0
elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
Expand Down Expand Up @@ -201,8 +213,9 @@ elif [[ "$1" == "cmake.c++20.test" ]]; then
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=20 \
${IWYU} \
"${SRC_DIR}"
make -j $(nproc)
eval "$MAKE_COMMAND"
make test
exit 0
elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
Expand All @@ -214,8 +227,9 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DWITH_STL=ON \
${IWYU} \
"${SRC_DIR}"
make -j $(nproc)
eval "$MAKE_COMMAND"
make test
exit 0
elif [[ "$1" == "cmake.legacy.test" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion ci/setup_ci_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ apt-get install --no-install-recommends --no-install-suggests -y \
wget \
git \
valgrind \
lcov
lcov \
iwyu

0 comments on commit 5466c5b

Please sign in to comment.