Skip to content

Commit

Permalink
Refactor iwyu build into docker install script. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsaintjacques authored and wesm committed Feb 14, 2019
1 parent e1c46c7 commit 56733fc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 20 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
6 changes: 5 additions & 1 deletion dev/lint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
21 changes: 2 additions & 19 deletions dev/lint/run_iwyu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# limitations under the License.
#

set -eux

export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX

mkdir -p /build/lint
Expand All @@ -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

0 comments on commit 56733fc

Please sign in to comment.