Skip to content

Commit a49f186

Browse files
Aditya Shastrifacebook-github-bot
authored andcommitted
Use -Werror during diff time build (#198)
Summary: Pull Request resolved: #198 Differential Revision: D36138984 fbshipit-source-id: caf4d15ed9134048dfd0f8cf9810ed1b5f46aea8
1 parent ea4765c commit a49f186

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

build-docker.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Usage: $PROG_NAME [-u] [-f] [-t TAG]
2222
2323
-u: builds the docker images against ubuntu (default)
2424
-f: forces a rebuild of all docker image dependencies (even if they already exist)
25+
-d: whether to build in dev mode. This sets the -Werror flag during the cmake build.
2526
-t TAG: Use the specified tag for the built image (default: latest)
2627
EOF
2728
exit 1
@@ -32,14 +33,16 @@ OS_RELEASE="${UBUNTU_RELEASE}"
3233
DOCKER_EXTENSION=".ubuntu"
3334
FORCE_REBUILD=false
3435
TAG="latest"
35-
while getopts "u,f,t:" o; do
36+
DEV_MODE=false
37+
while getopts "u,f,d,t:" o; do
3638
case $o in
3739
u)
3840
IMAGE_PREFIX="ubuntu"
3941
OS_RELEASE="${UBUNTU_RELEASE}"
4042
DOCKER_EXTENSION=".ubuntu"
4143
;;
4244
f) FORCE_REBUILD=true ;;
45+
d) DEV_MODE=true ;;
4346
t) TAG=$OPTARG;;
4447
*) usage ;;
4548
esac
@@ -91,11 +94,17 @@ build_dep_image "${FOLLY_IMAGE}" "folly" "--build-arg os_release=${OS_RELEASE} -
9194
FOLLY_IMAGE="${RETURN}"
9295

9396
printf "\nBuilding fbpcf/%s docker image...\n" ${IMAGE_PREFIX}
97+
CMAKE_FLAGS=""
98+
if [ "${DEV_MODE}" == true ]; then
99+
printf "Using dev mode. Passing -Werror to cmake."
100+
CMAKE_FLAGS="-Werror"
101+
fi
94102
docker build \
95103
--build-arg os_release="${OS_RELEASE}" \
96104
--build-arg emp_image="${EMP_IMAGE}" \
97105
--build-arg aws_image="${AWS_IMAGE}" \
98106
--build-arg folly_image="${FOLLY_IMAGE}" \
99107
--build-arg gcp_image="${GCP_IMAGE}" \
108+
--build-arg cmake_flags="${CMAKE_FLAGS}" \
100109
--compress \
101110
-t "fbpcf/${IMAGE_PREFIX}:${TAG}" -f "docker/Dockerfile${DOCKER_EXTENSION}" .

docker/Dockerfile.ubuntu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ARG emp_image="fbpcf/ubuntu-emp:0.2.3"
88
ARG aws_image="fbpcf/ubuntu-aws-s3-core:1.8.177"
99
ARG folly_image="fbpcf/ubuntu-folly:2021.03.29.00"
1010
ARG gcp_image="fbpcf/ubuntu-gcp-cloud-cpp:1.32.1"
11+
ARG cmake_flags=""
1112

1213
FROM ${emp_image} as emp
1314
FROM ${aws_image} as aws
@@ -57,7 +58,7 @@ COPY example/ ./example
5758
# Link all libraries post-install
5859
RUN ldconfig
5960

60-
RUN cmake . -DTHREADING=ON -DEMP_USE_RANDOM_DEVICE=ON
61+
RUN cmake . -DTHREADING=ON -DEMP_USE_RANDOM_DEVICE=ON $cmake_flags
6162
RUN make && make install
6263

6364
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)