Skip to content

Apache DataFusion SQL Query Engine

ARROW-3420: [C++] include-what-you-use cleanups for most of src/arrow, add "iwyu" target to top level docker-compose

Wes McKinney7422c6afb6bd
diff --git a/dev/docker_common/Dockerfile.xenial.base b/dev/docker_common/Dockerfile.xenial.base
index b2589de6d9..49d9fd72d9 100644
--- a/dev/docker_common/Dockerfile.xenial.base
+++ b/dev/docker_common/Dockerfile.xenial.base
@@ -45,6 +45,7 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -
pandas \
pytest \
cmake \
+ double-conversion \
flatbuffers \
rapidjson \
boost-cpp \
@@ -52,10 +53,16 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -
snappy \
zlib \
gflags \
+ glog \
+ gtest \
+ re2 \
brotli \
jemalloc \
lz4-c \
zstd \
setuptools \
setuptools_scm \
- && conda clean --all
\ No newline at end of file
+ && conda clean --all
+
+ADD docker_common/install_clang_tools_xenial.sh /
+RUN /install_clang_tools_xenial.sh
diff --git a/dev/docker_common/install_clang_tools_xenial.sh b/dev/docker_common/install_clang_tools_xenial.sh
new file mode 100755
index 0000000000..e35e3dca3c
--- /dev/null
+++ b/dev/docker_common/install_clang_tools_xenial.sh
@@ -0,0 +1,24 @@
+#!/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.
+
+wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|apt-key add -
+apt-add-repository -y \
+ "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-6.0 main"
+apt-get update -qq
+apt-get install -y -q libclang-6.0-dev clang-6.0 clang-format-6.0 clang-tidy-6.0
diff --git a/dev/iwyu/Dockerfile b/dev/iwyu/Dockerfile
index 3d93f90eb1..817472056b 100644
--- a/dev/iwyu/Dockerfile
+++ b/dev/iwyu/Dockerfile
@@ -17,7 +17,7 @@
FROM arrow_integration_xenial_base
-ADD . /apache-arrow
-WORKDIR /apache-arrow
+ADD dev/iwyu/run_iwyu.sh /run_iwyu.sh
-CMD arrow/dev/iwyu/run_iwyu.sh
+WORKDIR /tmp
+CMD /run_iwyu.sh
\ No newline at end of file
diff --git a/dev/iwyu/run_iwyu.sh b/dev/iwyu/run_iwyu.sh
index ae0f761888..9e2bd7e80a 100755
--- a/dev/iwyu/run_iwyu.sh
+++ b/dev/iwyu/run_iwyu.sh
@@ -18,8 +18,8 @@
# Set up environment and working directory
CLANG_VERSION=6.0
-IWYU_BUILD_DIR=`pwd`/arrow/cpp/docker-iwyu
-IWYU_SH=`pwd`/arrow/cpp/build-support/iwyu/iwyu.sh
+IWYU_BUILD_DIR=/arrow/cpp/docker-iwyu
+IWYU_SH=/arrow/cpp/build-support/iwyu/iwyu.sh
IWYU_URL=https://github.com/include-what-you-use/include-what-you-use/archive/clang_$CLANG_VERSION.tar.gz
rm -rf $IWYU_BUILD_DIR
@@ -49,6 +49,8 @@ pushd iwyu-build
# iwyu needs this
apt-get install -y zlib1g-dev
+source activate pyarrow-dev
+
cmake -G "Unix Makefiles" -DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$CLANG_VERSION $IWYU_SRC
make -j4
popd
@@ -56,11 +58,15 @@ popd
# Add iwyu and iwyu_tool.py to path
export PATH=$IWYU_BUILD_DIR/iwyu-build:$PATH
-conda activate pyarrow-dev
+export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX
-cmake -GNinja -DARROW_PYTHON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
+cmake -GNinja \
+ -DARROW_PARQUET=ON \
+ -DARROW_PYTHON=ON \
+ -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' \
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
# Make so that vendored bits are built
-ninja
+ninja arrow_shared
$IWYU_SH all
diff --git a/docker-compose.yml b/docker-compose.yml
index e407e6ef72..62c300328c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -120,6 +120,15 @@ services:
volumes:
- .:/arrow:delegated
+ # Depends on xenial base image, see dev/README.md
+ iwyu:
+ image: arrow:iwyu
+ build:
+ context: .
+ dockerfile: dev/iwyu/Dockerfile
+ volumes:
+ - .:/arrow:delegated
+
clang-format:
image: arrow:lint
shm_size: 2G