Skip to content

Commit

Permalink
feat!: add a dep on Abseil (#4087)
Browse files Browse the repository at this point in the history
Fixes: #2309

Adds a dep on Abseil. Uses absl::make_unique in one test in Spanner just to show that the Abseil dep is working in all the builds.
  • Loading branch information
devjgm committed May 12, 2020
1 parent 1f9ab3b commit e1b030c
Show file tree
Hide file tree
Showing 19 changed files with 493 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Expand Up @@ -11,11 +11,11 @@ IncludeBlocks: Merge
IncludeCategories:
# Matches common headers first, but sorts them after project includes
- Regex: '^\"google/cloud/(internal/|grpc_utils/|testing_util/|[^/]+\.h)'
Priority: 1500
Priority: 1000
- Regex: '^\"google/cloud/' # project includes should sort first
Priority: 500
- Regex: '^\"'
Priority: 1000
Priority: 1500
- Regex: '^<grpc/'
Priority: 2000
- Regex: '^<google/*'
Expand Down
11 changes: 11 additions & 0 deletions bazel/google_cloud_cpp_deps.bzl
Expand Up @@ -37,6 +37,17 @@ def google_cloud_cpp_deps():
sha256 = "d21d38c4b8e81eed8fa95ede48dd69aba01a3b938be6ac03d2b9dc61886a7183",
)

# Load Abseil
if "com_google_absl" not in native.existing_rules():
http_archive(
name = "com_google_absl",
strip_prefix = "abseil-cpp-20200225.2",
urls = [
"https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz",
],
sha256 = "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111",
)

# Load a version of googletest that we know works.
if "com_google_googletest" not in native.existing_rules():
http_archive(
Expand Down
24 changes: 19 additions & 5 deletions ci/kokoro/docker/Dockerfile.fedora-install
Expand Up @@ -31,6 +31,11 @@ RUN dnf makecache && \
RUN wget -q -O /usr/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/0.29.0/buildifier
RUN chmod 755 /usr/bin/buildifier

# Install shfmt to automatically format the Shell scripts.
RUN curl -L -o /usr/local/bin/shfmt \
"https://github.com/mvdan/sh/releases/download/v3.1.0/shfmt_v3.1.0_linux_amd64" && \
chmod 755 /usr/local/bin/shfmt

# Install cmake_format to automatically format the CMake list files.
# https://github.com/cheshirekow/cmake_format
# Pin this to an specific version because the formatting changes when the
Expand All @@ -42,17 +47,26 @@ RUN pip3 install cmake_format==0.6.8
# Install black to automatically format the Python files.
RUN pip3 install black==19.3b0

# Install shfmt to automatically format the Shell scripts.
RUN curl -L -o /usr/local/bin/shfmt \
"https://github.com/mvdan/sh/releases/download/v3.1.0/shfmt_v3.1.0_linux_amd64" && \
chmod 755 /usr/local/bin/shfmt

# Install the Python modules needed to run the storage testbench
RUN dnf makecache && dnf install -y python3-devel
RUN pip3 install setuptools
RUN pip3 install flask==1.1.1 Werkzeug==1.0.0 httpbin==0.7.0 \
gevent==1.4.0 gunicorn==19.10.0 crc32c==2.0

# Install Abseil, remove the downloaded files and the temporary artifacts
# after a successful build to keep the image smaller (and with fewer layers)
WORKDIR /var/tmp/build
RUN curl -sSL https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build

# Install googletest, remove the downloaded files and the temporary artifacts
# after a successful build to keep the image smaller (and with fewer layers)
WORKDIR /var/tmp/build
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.centos-7
Expand Up @@ -45,6 +45,25 @@ ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PATH=/usr/local/bin:${PATH}
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.centos-8
Expand Up @@ -41,6 +41,25 @@ ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PATH=/usr/local/bin:${PATH}
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.debian-buster
Expand Up @@ -37,6 +37,25 @@ RUN apt-get update && \
protobuf-compiler protobuf-compiler-grpc
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### crc32c

# The project depends on the Crc32c library, we need to compile this from
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.debian-stretch
Expand Up @@ -35,6 +35,25 @@ RUN apt-get update && \
pkg-config tar wget zlib1g-dev
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.fedora
Expand Up @@ -43,6 +43,25 @@ RUN dnf makecache && \
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### crc32c

# The project depends on the Crc32c library, we need to compile this from
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.opensuse-leap
Expand Up @@ -40,6 +40,25 @@ ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PATH=/usr/local/bin:${PATH}
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.opensuse-tumbleweed
Expand Up @@ -41,6 +41,25 @@ RUN zypper refresh && \
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### crc32c

# The project depends on the Crc32c library, we need to compile this from
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.ubuntu-bionic
Expand Up @@ -28,6 +28,25 @@ RUN apt-get update && \
pkg-config tar wget zlib1g-dev
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.ubuntu-focal
Expand Up @@ -29,6 +29,25 @@ RUN apt-get update && \
pkg-config tar wget zlib1g-dev
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down
19 changes: 19 additions & 0 deletions ci/kokoro/install/Dockerfile.ubuntu-xenial
Expand Up @@ -28,6 +28,25 @@ RUN apt-get update && \
pkg-config tar wget zlib1g-dev
# ```

# #### Abseil

# We need a recent version of Abseil.

# ```bash
WORKDIR /var/tmp/build
RUN wget -q https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz && \
tar -xf 20200225.2.tar.gz && \
cd abseil-cpp-20200225.2 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-H. -Bcmake-out/abseil && \
cmake --build cmake-out/abseil --target install -- -j ${NCPU} && \
ldconfig && \
cd /var/tmp && rm -fr build
# ```

# #### Protobuf

# We need to install a version of Protobuf that is recent enough to support the
Expand Down

0 comments on commit e1b030c

Please sign in to comment.