summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-05 13:21:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-10-05 13:22:09 (GMT)
commit6ace9562e730328b87ad5b56390e70cb7704050a (patch)
treee458d61de03619c45823a182edf31da7dcafbde8
parentf2a4d7b2c364858778fc84d611a24655d2afd70c (diff)
parentc239e7c259a2af4987a4f754cee228f1f4bdcc97 (diff)
downloadCMake-6ace9562e730328b87ad5b56390e70cb7704050a.zip
CMake-6ace9562e730328b87ad5b56390e70cb7704050a.tar.gz
CMake-6ace9562e730328b87ad5b56390e70cb7704050a.tar.bz2
Merge topic 'fedora-iwyu'
c239e7c259 ci: add include-what-you-use to Fedora base image Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7744
-rw-r--r--.gitlab/ci/docker/fedora36/Dockerfile9
-rwxr-xr-x.gitlab/ci/docker/fedora36/install_iwyu.sh44
-rw-r--r--.gitlab/os-linux.yml2
3 files changed, 54 insertions, 1 deletions
diff --git a/.gitlab/ci/docker/fedora36/Dockerfile b/.gitlab/ci/docker/fedora36/Dockerfile
index 299d48a..ea42561 100644
--- a/.gitlab/ci/docker/fedora36/Dockerfile
+++ b/.gitlab/ci/docker/fedora36/Dockerfile
@@ -10,6 +10,12 @@ MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
COPY install_clang_tidy_headers.sh /root/install_clang_tidy_headers.sh
RUN sh /root/install_clang_tidy_headers.sh
+FROM fedora:36 AS iwyu
+MAINTAINER Kyle Edwards <kyle.edwards@kitware.com>
+
+COPY install_iwyu.sh /root/install_iwyu.sh
+RUN sh /root/install_iwyu.sh
+
FROM fedora:36
MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
@@ -22,3 +28,6 @@ RUN tar -C /usr/local -xf /root/rvm.tar \
COPY --from=clang-tidy-headers /root/clang-tidy-headers.tar /root/clang-tidy-headers.tar
RUN tar -C /usr/include -xf /root/clang-tidy-headers.tar \
&& rm /root/clang-tidy-headers.tar
+COPY --from=iwyu /root/iwyu.tar /root/iwyu.tar
+RUN tar -C / -xf /root/iwyu.tar \
+ && rm /root/iwyu.tar
diff --git a/.gitlab/ci/docker/fedora36/install_iwyu.sh b/.gitlab/ci/docker/fedora36/install_iwyu.sh
new file mode 100755
index 0000000..714bcc0
--- /dev/null
+++ b/.gitlab/ci/docker/fedora36/install_iwyu.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+set -e
+
+# Install development tools.
+dnf install --setopt=install_weak_deps=False -y \
+ clang-devel \
+ llvm-devel \
+ zlib-devel \
+ g++ \
+ cmake \
+ ninja-build \
+ git
+
+cd /root
+git clone "https://github.com/include-what-you-use/include-what-you-use.git"
+cd include-what-you-use
+readonly llvm_full_version="$( clang --version | head -n1 | cut -d' ' -f3 )"
+readonly llvm_version="$( echo "$llvm_full_version" | cut -d. -f-1 )"
+git checkout "clang_$llvm_version"
+git apply <<EOF
+diff --git a/iwyu_driver.cc b/iwyu_driver.cc
+index 42fea35..fbb77a9 100644
+--- a/iwyu_driver.cc
++++ b/iwyu_driver.cc
+@@ -167,6 +167,7 @@ CompilerInstance* CreateCompilerInstance(int argc, const char **argv) {
+ DiagnosticsEngine diagnostics(diagnostic_id, &*diagnostic_options,
+ diagnostic_client);
+ Driver driver(path, getDefaultTargetTriple(), diagnostics);
++ driver.ResourceDir = "/usr/lib64/clang/$llvm_full_version";
+ driver.setTitle("include what you use");
+
+ // Expand out any response files passed on the command line
+EOF
+mkdir build
+cd build
+
+cmake -GNinja \
+ -DCMAKE_BUILD_TYPE=Release \
+ "-DCMAKE_INSTALL_PREFIX=/usr/local/lib64/llvm-$llvm_version" \
+ ..
+ninja
+DESTDIR=/root/iwyu-destdir ninja install
+tar -C /root/iwyu-destdir -cf /root/iwyu.tar .
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index a46ec22..84950d2 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -69,7 +69,7 @@
### Fedora
.fedora36:
- image: "kitware/cmake:ci-fedora36-x86_64-2022-08-31"
+ image: "kitware/cmake:ci-fedora36-x86_64-2022-10-04"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"