Skip to content

Apache DataFusion SQL Query Engine

ARROW-2952: [C++] Dockerized include-what-you-use

Wes McKinneyea4f56400777
diff --git a/dev/README.md b/dev/README.md
index 276d75f48b..98aeef6d9a 100644
--- a/dev/README.md
+++ b/dev/README.md
@@ -123,6 +123,12 @@ bash dev/release/js-verify-release-candidate.sh 0.7.0 0
```
# Integration testing
+Build the following base image used by multiple tests:
+
+```shell
+docker build -t arrow_integration_xenial_base -f docker_common/Dockerfile.xenial.base .
+```
+
## HDFS C++ / Python support
```shell
diff --git a/dev/dask_integration/Dockerfile b/dev/dask_integration/Dockerfile
index f72ef8ca0d..f0c1f03f6f 100644
--- a/dev/dask_integration/Dockerfile
+++ b/dev/dask_integration/Dockerfile
@@ -14,75 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM ubuntu:14.04
+FROM arrow_integration_xenial_base
+
ADD . /apache-arrow
WORKDIR /apache-arrow
-# Basic OS utilities
-RUN apt-get update && apt-get install -y \
- wget \
- git \
- gcc \
- g++
-# This will install conda in /home/ubuntu/miniconda
-RUN wget -O /tmp/miniconda.sh \
- https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
- bash /tmp/miniconda.sh -b -p /home/ubuntu/miniconda && \
- rm /tmp/miniconda.sh
-# Create Conda environment
-ENV PATH="/home/ubuntu/miniconda/bin:${PATH}"
-RUN conda create -y -q -n test-environment \
- python=3.6
-# Install dependencies
-RUN conda install -c conda-forge \
- numpy \
- pandas \
- bcolz \
- blosc \
- bokeh \
- boto3 \
- chest \
- cloudpickle \
- coverage \
- cytoolz \
- distributed \
- graphviz \
- h5py \
- ipython \
- partd \
- psutil \
- "pytest<=3.1.1" \
- scikit-image \
- scikit-learn \
- scipy \
- sqlalchemy \
- toolz
-# install pytables from defaults for now
-RUN conda install pytables
-
-RUN pip install -q git+https://github.com/dask/partd --upgrade --no-deps
-RUN pip install -q git+https://github.com/dask/zict --upgrade --no-deps
-RUN pip install -q git+https://github.com/dask/distributed --upgrade --no-deps
-RUN pip install -q git+https://github.com/mrocklin/sparse --upgrade --no-deps
-RUN pip install -q git+https://github.com/dask/s3fs --upgrade --no-deps
-
-RUN conda install -q -c conda-forge numba cython
-RUN pip install -q git+https://github.com/dask/fastparquet
-
-RUN pip install -q \
- cachey \
- graphviz \
- moto \
- pyarrow \
- --upgrade --no-deps
-
-RUN pip install -q \
- cityhash \
- flake8 \
- mmh3 \
- pandas_datareader \
- pytest-xdist \
- xxhash \
- pycodestyle
CMD arrow/dev/dask_integration/dask_integration.sh
-
diff --git a/dev/dask_integration/dask_integration.sh b/dev/dask_integration/dask_integration.sh
index f5a24e462b..fb519c8d77 100755
--- a/dev/dask_integration/dask_integration.sh
+++ b/dev/dask_integration/dask_integration.sh
@@ -19,6 +19,55 @@
# Set up environment and working directory
cd /apache-arrow
+source activate pyarrow-dev
+
+# install pytables from defaults for now
+conda install -y pytables
+
+pip install -q git+https://github.com/dask/partd --upgrade --no-deps
+pip install -q git+https://github.com/dask/zict --upgrade --no-deps
+pip install -q git+https://github.com/dask/distributed --upgrade --no-deps
+pip install -q git+https://github.com/mrocklin/sparse --upgrade --no-deps
+pip install -q git+https://github.com/dask/s3fs --upgrade --no-deps
+
+conda install -y -q -c conda-forge numba cython \
+ bcolz \
+ blosc \
+ bokeh \
+ boto3 \
+ chest \
+ cloudpickle \
+ coverage \
+ cytoolz \
+ distributed \
+ graphviz \
+ h5py \
+ partd \
+ psutil \
+ "pytest<=3.1.1" \
+ scikit-image \
+ scikit-learn \
+ sqlalchemy \
+ toolz
+
+pip install -q git+https://github.com/dask/fastparquet
+
+pip install -q \
+ cachey \
+ graphviz \
+ moto \
+ pyarrow \
+ --upgrade --no-deps
+
+pip install -q \
+ cityhash \
+ flake8 \
+ mmh3 \
+ pandas_datareader \
+ pytest-xdist \
+ xxhash \
+ pycodestyle
+
export ARROW_BUILD_TYPE=release
export ARROW_HOME=$(pwd)/dist
export PARQUET_HOME=$(pwd)/dist
diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml
index c4500986ca..8f20dde2ed 100644
--- a/dev/docker-compose.yml
+++ b/dev/docker-compose.yml
@@ -67,6 +67,12 @@ services:
volumes:
- ../..:/apache-arrow
+ iwyu:
+ build:
+ context: iwyu
+ volumes:
+ - ../..:/apache-arrow
+
run_site:
build:
context: run_site
diff --git a/dev/gen_apidocs/Dockerfile b/dev/gen_apidocs/Dockerfile
index 13a6ff4a0f..606ae2e266 100644
--- a/dev/gen_apidocs/Dockerfile
+++ b/dev/gen_apidocs/Dockerfile
@@ -39,47 +39,24 @@ RUN apt-get update && \
autoconf-archive \
npm
-# This will install conda in /home/ubuntu/miniconda
-RUN wget -O /tmp/miniconda.sh \
- https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
- bash /tmp/miniconda.sh -b -p /home/ubuntu/miniconda && \
- rm /tmp/miniconda.sh
+
+ENV CC=gcc-8
+ENV CXX=g++-8
+
+ADD . /apache-arrow
+WORKDIR /apache-arrow
+
+RUN arrow/dev/docker_common/install_pyarrow_conda_toolchain.sh 3.6
+ENV PATH="/opt/conda/bin:${PATH}"
# Python dependencies
# Create Conda environment
RUN /home/ubuntu/miniconda/bin/conda create -y -q -n pyarrow-dev \
- # Python
- python=3.6 \
- numpy \
- pandas \
- pytest \
- cython \
- ipython \
- matplotlib \
numpydoc \
sphinx \
sphinx_bootstrap_theme \
- six \
- setuptools \
- # C++
- boost-cpp \
- cmake \
- flatbuffers \
- rapidjson \
- thrift-cpp \
- snappy \
- zlib \
- brotli \
- jemalloc \
- lz4-c \
- zstd \
doxygen \
maven \
-c conda-forge
-ENV CC=gcc-8
-ENV CXX=g++-8
-
-ADD . /apache-arrow
-WORKDIR /apache-arrow
CMD arrow/dev/gen_apidocs/create_documents.sh
diff --git a/dev/hdfs_integration/Dockerfile b/dev/hdfs_integration/Dockerfile
index 71dcbe3aa2..1279efc06e 100644
--- a/dev/hdfs_integration/Dockerfile
+++ b/dev/hdfs_integration/Dockerfile
@@ -18,8 +18,7 @@
FROM gelog/hadoop
ENV CC=gcc \
- CXX=g++ \
- PATH=/opt/conda/bin:$PATH
+ CXX=g++
RUN apt-get update -y \
&& apt-get install -y \
@@ -30,14 +29,14 @@ RUN apt-get update -y \
pkg-config \
ninja-build
-# Miniconda - Python 3.6, 64-bit, x86, latest
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O conda.sh \
&& /bin/bash conda.sh -b -p /opt/conda \
&& rm conda.sh
-# create conda env with the required dependences
RUN conda create -y -q -c conda-forge -n pyarrow-dev \
- python=3.6 \
+ python=$1 \
+ ipython \
+ matplotlib \
nomkl \
numpy \
six \
@@ -57,8 +56,12 @@ RUN conda create -y -q -c conda-forge -n pyarrow-dev \
jemalloc \
lz4-c \
zstd \
+ setuptools \
+ setuptools_scm \
&& conda clean --all
+ENV PATH="/opt/conda/bin:${PATH}"
+
# installing in the previous step boost=1.60 and boost-cpp=1.67 gets installed,
# cmake finds 1.60 and parquet fails to compile
# installing it in a separate step, boost=1.60 and boost-cpp=1.64 gets
diff --git a/dev/iwyu/Dockerfile b/dev/iwyu/Dockerfile
new file mode 100644
index 0000000000..3d93f90eb1
--- /dev/null
+++ b/dev/iwyu/Dockerfile
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+FROM arrow_integration_xenial_base
+
+ADD . /apache-arrow
+WORKDIR /apache-arrow
+
+CMD arrow/dev/iwyu/run_iwyu.sh
diff --git a/dev/iwyu/run_iwyu.sh b/dev/iwyu/run_iwyu.sh
new file mode 100755
index 0000000000..e33b3f71be
--- /dev/null
+++ b/dev/iwyu/run_iwyu.sh
@@ -0,0 +1,66 @@
+#!/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 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_URL=https://github.com/include-what-you-use/include-what-you-use/archive/clang_$CLANG_VERSION.tar.gz
+
+rm -rf $IWYU_BUILD_DIR
+mkdir -p $IWYU_BUILD_DIR
+pushd $IWYU_BUILD_DIR
+
+function cleanup {
+ popd
+ rm -rf $IWYU_BUILD_DIR
+}
+
+trap cleanup EXIT
+
+# Build IWYU
+wget -O iwyu.tar.gz $IWYU_URL
+tar xzf iwyu.tar.gz
+rm -f iwyu.tar.gz
+
+IWYU_SRC=`pwd`/include-what-you-use-clang_$CLANG_VERSION
+
+export CC=clang-$CLANG_VERSION
+export CXX=clang++-$CLANG_VERSION
+
+mkdir -p iwyu-build
+pushd iwyu-build
+
+# iwyu needs this
+apt-get install -y zlib1g-dev
+
+cmake -G "Unix Makefiles" -DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$CLANG_VERSION $IWYU_SRC
+make -j4
+popd
+
+# Add iwyu and iwyu_tool.py to path
+export PATH=$IWYU_BUILD_DIR/iwyu-build:$PATH
+
+source activate pyarrow-dev
+
+cmake -GNinja -DARROW_PYTHON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
+
+# Make so that vendored bits are built
+ninja
+
+$IWYU_SH all
diff --git a/dev/spark_integration/Dockerfile b/dev/spark_integration/Dockerfile
index f96ee35789..84b93c9a6e 100644
--- a/dev/spark_integration/Dockerfile
+++ b/dev/spark_integration/Dockerfile
@@ -27,41 +27,39 @@ RUN apt-get update && \
# install conda in /home/ubuntu/miniconda
wget -O /tmp/miniconda.sh \
https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
- bash /tmp/miniconda.sh -b -p /home/ubuntu/miniconda && \
+ bash /tmp/miniconda.sh -b -p /opt/conda && \
rm /tmp/miniconda.sh && \
# Python dependencies
apt-get install -y \
pkg-config && \
- # Create Conda environment
- /home/ubuntu/miniconda/bin/conda create -y -q -n pyarrow-dev \
- # Python
- python=2.7 \
- numpy \
- pandas \
- pytest \
- cython \
- ipython \
- matplotlib \
- six \
- setuptools \
- setuptools_scm \
- # C++
- boost-cpp \
- cmake \
- flatbuffers \
- rapidjson \
- thrift-cpp \
- snappy \
- zlib \
- gflags \
- brotli \
- jemalloc \
- lz4-c \
- zstd \
- -c conda-forge && \
- /home/ubuntu/miniconda/bin/conda clean --all
-ENV PATH="/home/ubuntu/miniconda/bin:${PATH}"
+ENV PATH="/opt/conda/bin:${PATH}"
+
+RUN conda create -y -q -c conda-forge -n pyarrow-dev \
+ python=2.7 \
+ ipython \
+ nomkl \
+ numpy \
+ six \
+ setuptools \
+ cython \
+ pandas \
+ pytest \
+ cmake \
+ flatbuffers \
+ rapidjson \
+ boost-cpp \
+ thrift-cpp \
+ snappy \
+ zlib \
+ gflags \
+ brotli \
+ jemalloc \
+ lz4-c \
+ zstd \
+ setuptools \
+ setuptools_scm \
+ && conda clean --all
ADD . /apache-arrow
WORKDIR /apache-arrow