Skip to content

Commit

Permalink
ARROW-4340: [C++][CI] Build IWYU for LLVM 7 in iwyu docker-compose job
Browse files Browse the repository at this point in the history
Following the instructions in docker-compose.yml gives me a working IWYU build now

```
export PYTHON_VERSION=3.6
docker-compose build cpp
docker-compose build python
docker-compose build lint
docker-compose run iwyu
```

Author: François Saint-Jacques <[email protected]>
Author: Wes McKinney <[email protected]>

Closes #3643 from wesm/ARROW-4340 and squashes the following commits:

56733fc <François Saint-Jacques> Refactor iwyu build into docker install script. (#8)
e1c46c7 <Wes McKinney> Build IWYU for LLVM 7 in iwyu docker-compose job
  • Loading branch information
fsaintjacques authored and wesm committed Feb 14, 2019
1 parent 69d595a commit 2571b03
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
39 changes: 39 additions & 0 deletions ci/docker_install_iwyu.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions dev/lint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
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 \
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
ENV PATH=/opt/iwyu/bin:$PATH
ADD ci/docker_install_iwyu.sh /arrow/ci/
RUN arrow/ci/docker_install_iwyu.sh
6 changes: 4 additions & 2 deletions dev/lint/run_iwyu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@
# limitations under the License.
#

set -eux

export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX

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

Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2571b03

Please sign in to comment.