0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/evergreen/ninja_compile.sh
Trevor Guidry 174003ce8e SERVER-87594 Add compile variant that simulates a workstation build (#21010)
GitOrigin-RevId: 885acdd13d1f221aa3c3508ce2a12bc58fe8475a
2024-04-11 22:58:00 +00:00

35 lines
891 B
Bash

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
. "$DIR/prelude.sh"
cd src
set -o errexit
set -o verbose
activate_venv
if [[ -n "${ninja_jobs}" ]]; then
JOBS_ARG="-j${ninja_jobs}"
fi
if [ "Windows_NT" = "$OS" ]; then
vcvars="$(vswhere -latest -property installationPath | tr '\\' '/' | dos2unix.exe)/VC/Auxiliary/Build/"
echo "call \"$vcvars/vcvarsall.bat\" amd64" > msvc.bat
for i in "${compile_env[@]}"; do
echo "set $i" >> msvc.bat
done
echo "ninja -f ${ninja_file} ${JOBS_ARG} ${targets}" >> msvc.bat
for i in $(seq ${ninja_retries:=1}); do
cmd /C msvc.bat && RET=0 && break || RET=$? && sleep 1
done
else
for i in $(seq ${ninja_retries:=1}); do
eval ${compile_env} ninja -f ${ninja_file} ${JOBS_ARG} ${targets} && RET=0 && break || RET=$? && sleep 1
done
fi
if [ $RET -ne 0 ]; then
echo "Ninja command failed"
exit $RET
fi