From e1c46c7212971432dc1c7af867d7b542859d34a5 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Wed, 13 Feb 2019 23:02:48 -0600 Subject: [PATCH 1/2] Build IWYU for LLVM 7 in iwyu docker-compose job Change-Id: I3bf8bd27728094656e81af480de607853259c694 --- dev/lint/Dockerfile | 4 +--- dev/lint/run_iwyu.sh | 23 +++++++++++++++++++++-- docker-compose.yml | 3 --- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dev/lint/Dockerfile b/dev/lint/Dockerfile index e3562c5f21c..a468e2e9b18 100644 --- a/dev/lint/Dockerfile +++ b/dev/lint/Dockerfile @@ -21,12 +21,10 @@ RUN apt-get install -y -q gnupg && \ apt update && \ apt-get install -y -q \ clang-7 \ + libclang-7-dev \ clang-format-7 \ clang-tidy-7 \ clang-tools-7 RUN conda install flake8 && \ conda clean --all -y - -# https://bugs.launchpad.net/ubuntu/+source/iwyu/+bug/1769334 -RUN ln -sv /usr/lib/clang/6.0 /usr/lib/clang/5.0.1 diff --git a/dev/lint/run_iwyu.sh b/dev/lint/run_iwyu.sh index 3f39357ae32..b3d8c8ebf5a 100755 --- a/dev/lint/run_iwyu.sh +++ b/dev/lint/run_iwyu.sh @@ -22,15 +22,34 @@ mkdir -p /build/lint pushd /build/lint cmake -GNinja \ + -DARROW_FLIGHT=ON \ + -DARROW_GANDIVA=ON \ -DARROW_PARQUET=ON \ -DARROW_PYTHON=ON \ -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ /arrow/cpp -# Make so that vendored bits are built -ninja arrow_shared popd +# Build IWYU for current Clang +git clone https://github.com/include-what-you-use/include-what-you-use.git +pushd include-what-you-use +git checkout clang_7.0 +popd + +export CC=clang-7 +export CXX=clang++-7 + +mkdir -p iwyu +pushd iwyu +cmake -G "Unix Makefiles" \ + -DCMAKE_PREFIX_PATH=/usr/lib/llvm-7 \ + ../include-what-you-use +make -j4 +popd + +export PATH=`pwd`/iwyu/bin:$PATH + export IWYU_COMPILATION_DATABASE_PATH=/build/lint /arrow/cpp/build-support/iwyu/iwyu.sh all diff --git a/docker-compose.yml b/docker-compose.yml index b93fed74b18..b322d9b84f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -207,9 +207,6 @@ services: # docker-compose build lint # docker-compose run iwyu image: arrow:lint - environment: - CC: clang - CXX: clang++ command: arrow/dev/lint/run_iwyu.sh volumes: *ubuntu-volumes From 56733fc22c6ce0abcf9f04ac3e1ae3708f34faa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Saint-Jacques?= Date: Thu, 14 Feb 2019 10:22:42 -0500 Subject: [PATCH 2/2] Refactor iwyu build into docker install script. (#8) --- ci/docker_install_iwyu.sh | 39 +++++++++++++++++++++++++++++++++++++++ dev/lint/Dockerfile | 6 +++++- dev/lint/run_iwyu.sh | 21 ++------------------- 3 files changed, 46 insertions(+), 20 deletions(-) create mode 100755 ci/docker_install_iwyu.sh diff --git a/ci/docker_install_iwyu.sh b/ci/docker_install_iwyu.sh new file mode 100755 index 00000000000..5206f3b47d9 --- /dev/null +++ b/ci/docker_install_iwyu.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -eu + +: ${IWYU_REPO:="https://github.com/include-what-you-use/include-what-you-use.git"} +: ${IWYU_BRANCH:="clang_7.0"} +: ${IWYU_SRC:="/tmp/iwyu"} +: ${IWYU_HOME:="/opt/iwyu"} + +git clone "${IWYU_REPO}" "${IWYU_SRC}" +git -C "${IWYU_SRC}" checkout ${IWYU_BRANCH} + +mkdir -p "${IWYU_HOME}" +pushd "${IWYU_HOME}" + +# Build IWYU for current Clang +export CC=clang-7 +export CXX=clang++-7 + +cmake -DCMAKE_PREFIX_PATH=/usr/lib/llvm-7 "${IWYU_SRC}" +make -j4 + +popd diff --git a/dev/lint/Dockerfile b/dev/lint/Dockerfile index a468e2e9b18..9a547c86d8a 100644 --- a/dev/lint/Dockerfile +++ b/dev/lint/Dockerfile @@ -18,7 +18,7 @@ FROM arrow:python-3.6 RUN apt-get install -y -q gnupg && \ - apt update && \ + apt-get update && \ apt-get install -y -q \ clang-7 \ libclang-7-dev \ @@ -28,3 +28,7 @@ RUN apt-get install -y -q gnupg && \ RUN conda install flake8 && \ conda clean --all -y + +ENV PATH=/opt/iwyu/bin:$PATH +ADD ci/docker_install_iwyu.sh /arrow/ci/ +RUN arrow/ci/docker_install_iwyu.sh diff --git a/dev/lint/run_iwyu.sh b/dev/lint/run_iwyu.sh index b3d8c8ebf5a..050096809bb 100755 --- a/dev/lint/run_iwyu.sh +++ b/dev/lint/run_iwyu.sh @@ -16,6 +16,8 @@ # limitations under the License. # +set -eux + export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX mkdir -p /build/lint @@ -32,24 +34,5 @@ cmake -GNinja \ popd -# Build IWYU for current Clang -git clone https://github.com/include-what-you-use/include-what-you-use.git -pushd include-what-you-use -git checkout clang_7.0 -popd - -export CC=clang-7 -export CXX=clang++-7 - -mkdir -p iwyu -pushd iwyu -cmake -G "Unix Makefiles" \ - -DCMAKE_PREFIX_PATH=/usr/lib/llvm-7 \ - ../include-what-you-use -make -j4 -popd - -export PATH=`pwd`/iwyu/bin:$PATH - export IWYU_COMPILATION_DATABASE_PATH=/build/lint /arrow/cpp/build-support/iwyu/iwyu.sh all