Skip to content

Commit ea5cb6a

Browse files
authored
Use uvx for CMake and Server Toolchain for Ninja (#1428)
* Upgrade uv to 0.8.6 with checksum validation * Consistently use CMAKE_BUILD_PARALLEL_LEVEL (/maxcpucount) for MSBuild
1 parent c39093a commit ea5cb6a

37 files changed

+1500
-1184
lines changed

.evergreen/config_generator/components/abi_stability.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from config_generator.components.funcs.install_c_driver import InstallCDriver
2+
from config_generator.components.funcs.install_uv import InstallUV
23

34
from config_generator.etc.distros import find_large_distro
45
from config_generator.etc.function import Function, merge_defns
@@ -182,16 +183,21 @@ def task_groups():
182183
EvgTaskGroup(
183184
name=f'tg-{TAG}-{polyfill}-cxx{cxx_standard}',
184185
max_hosts=-1,
185-
setup_group_can_fail_task=True,
186+
setup_task_can_fail_task=True,
186187
setup_task=[
187188
git_get_project(directory='mongo-cxx-driver'),
189+
InstallUV.call(),
188190
InstallCDriver.call(),
189191
bash_exec(
192+
command_type=EvgCommandType.SETUP,
190193
env={
191194
'cxx_standard': f'{cxx_standard}',
192195
'polyfill': polyfill,
193196
},
194-
include_expansions_in_env=['distro_id'],
197+
include_expansions_in_env=[
198+
'distro_id',
199+
'UV_INSTALL_DIR',
200+
],
195201
script='mongo-cxx-driver/.evergreen/scripts/abi-stability-setup.sh'
196202
),
197203
s3_put(

.evergreen/config_generator/components/atlas_search_indexes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def tasks():
5555
tags=[TAG, distro_name],
5656
run_on=distro.name,
5757
commands=[
58-
InstallCDriver.call(),
5958
InstallUV.call(),
59+
InstallCDriver.call(),
6060
Compile.call(build_type='Debug', vars={'ENABLE_TESTS': 'ON'}),
6161
TestSearchIndexHelpers.call(),
6262
],

.evergreen/config_generator/components/cmake_compat.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
# pylint: disable=line-too-long
1717
# fmt: off
1818
MATRIX = [
19-
("min", [3, 15, 4]),
20-
("max-v3", [3, 31, 7]),
21-
("max", [4, 0, 1]),
19+
# As-if `cmake~=<version>` (PEP 0440).
20+
("min", "3.15.0"),
21+
("max-v3", "3.0" ),
22+
("max", "4.0.0" ),
2223
]
2324
# fmt: on
2425

@@ -30,20 +31,20 @@ class CMakeCompat(Function):
3031
command_type=EvgCommandType.TEST,
3132
working_dir='mongo-cxx-driver',
3233
include_expansions_in_env=[
33-
'CMAKE_MAJOR_VERSION',
34-
'CMAKE_MINOR_VERSION',
35-
'CMAKE_PATCH_VERSION',
34+
'CMAKE_VERSION',
35+
'distro_id',
3636
'INSTALL_C_DRIVER',
37+
'UV_INSTALL_DIR',
3738
],
3839
script='.evergreen/scripts/cmake-compat.sh',
3940
),
4041
bash_exec(
4142
command_type=EvgCommandType.TEST,
4243
include_expansions_in_env=[
43-
'CMAKE_MAJOR_VERSION',
44-
'CMAKE_MINOR_VERSION',
45-
'CMAKE_PATCH_VERSION',
44+
'CMAKE_VERSION',
45+
'distro_id',
4646
'INSTALL_C_DRIVER',
47+
'UV_INSTALL_DIR',
4748
],
4849
script='mongo-cxx-driver/.evergreen/scripts/cmake-compat-check.sh',
4950
),
@@ -69,9 +70,7 @@ def tasks():
6970
(InstallCDriver.call() if install_c_driver else FetchCDriverSource.call()),
7071
CMakeCompat.call(
7172
vars={
72-
'CMAKE_MAJOR_VERSION': version[0],
73-
'CMAKE_MINOR_VERSION': version[1],
74-
'CMAKE_PATCH_VERSION': version[2],
73+
'CMAKE_VERSION': version,
7574
'INSTALL_C_DRIVER': int(install_c_driver),
7675
},
7776
),

.evergreen/config_generator/components/compile_only.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ def tasks():
9494
commands = [expansions_update(updates=updates)] if updates else []
9595
commands += [
9696
Setup.call(),
97-
InstallCDriver.call(),
9897
InstallUV.call(),
98+
InstallCDriver.call(),
9999
Compile.call(
100100
build_type=build_type,
101101
compiler=compiler,

.evergreen/config_generator/components/funcs/install_uv.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,31 @@ class InstallUV(Function):
1515
set -o errexit
1616
set -o pipefail
1717
18+
version="0.8.6"
19+
1820
if [[ ! -n "${MONGO_CXX_DRIVER_CACHE_DIR}" ]]; then
1921
echo "MONGO_CXX_DRIVER_CACHE_DIR is not defined!" 1>&2
2022
exit 1
2123
fi
2224
23-
uv_install_dir="${MONGO_CXX_DRIVER_CACHE_DIR}/uv-0.5.14"
25+
uv_install_dir="${MONGO_CXX_DRIVER_CACHE_DIR}/uv-$version"
2426
mkdir -p "$uv_install_dir"
2527
26-
if ! command -v "$uv_install_dir/uv" 2>/dev/null; then
28+
# Install if the binary is missing or the incorrect version.
29+
if ! (command -v "$uv_install_dir/uv" >/dev/null && "$uv_install_dir/uv" --version 2>/dev/null | grep "$version"); then
30+
script="$(mktemp)"
31+
cp -f mongo-cxx-driver/.evergreen/scripts/uv-installer.sh "$script"
32+
chmod +x "$script"
33+
# Always patch the install script so it validates checksums.
34+
(
35+
. mongo-cxx-driver/.evergreen/scripts/patch-uv-installer.sh
36+
patch_uv_installer "$script" "$version"
37+
)
2738
env \\
2839
UV_INSTALL_DIR="$uv_install_dir" \\
2940
UV_UNMANAGED_INSTALL=1 \\
3041
INSTALLER_PRINT_VERBOSE=1 \\
31-
mongo-cxx-driver/.evergreen/scripts/uv-installer.sh
42+
"$script"
3243
fi
3344
3445
PATH="$uv_install_dir:$PATH" command -V uv

.evergreen/config_generator/components/funcs/setup.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
from config_generator.etc.function import Function
2-
from config_generator.etc.utils import bash_exec
32

4-
from shrub.v3.evg_command import EvgCommandType, git_get_project
3+
from shrub.v3.evg_command import git_get_project
54

65

76
class Setup(Function):
87
name = 'setup'
9-
commands = [
10-
bash_exec(
11-
command_type=EvgCommandType.SETUP,
12-
script='''\
13-
set -o errexit
14-
set -o pipefail
15-
rm -rf "mongo-cxx-driver"
16-
rm -fr "mongo-c-driver"
17-
rm -fr mongod
18-
rm -fr drivers-evergreen-tools
19-
'''
20-
),
21-
git_get_project(directory='mongo-cxx-driver'),
22-
bash_exec(
23-
command_type=EvgCommandType.SETUP,
24-
script='''\
25-
set -o errexit
26-
set -o pipefail
27-
cc --version || true
28-
c++ --version || true
29-
gcc --version || true
30-
g++ --version || true
31-
clang --version || true
32-
cmake --version || true
33-
openssl version || true
34-
'''
35-
),
36-
]
8+
commands = git_get_project(directory='mongo-cxx-driver')
379

3810

3911
def functions():

.evergreen/config_generator/components/funcs/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Test(Function):
3838
'TEST_WITH_VALGRIND',
3939
'use_mongocryptd',
4040
'USE_STATIC_LIBS',
41+
'UV_INSTALL_DIR',
4142
'VALGRIND_INSTALL_DIR',
4243
],
4344
working_dir='mongo-cxx-driver',

.evergreen/config_generator/components/integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def tasks():
134134
commands += [
135135
Setup.call(),
136136
StartMongod.call(mongodb_version=mongodb_version, topology=topology),
137-
InstallCDriver.call(vars=icd_vars),
138137
InstallUV.call(),
138+
InstallCDriver.call(vars=icd_vars),
139139
Compile.call(polyfill=polyfill, vars=compile_vars),
140140
FetchDET.call(),
141141
RunKMSServers.call(),

.evergreen/config_generator/components/lint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class Lint(Function):
1919
command_type=EvgCommandType.TEST,
2020
working_dir='mongo-cxx-driver',
2121
env={'DRYRUN': '1'},
22-
script='${UV_INSTALL_DIR}/uv run --frozen etc/clang-format-all.sh',
22+
script='''\
23+
PATH="${UV_INSTALL_DIR}:$PATH" uv run --frozen etc/clang-format-all.sh
24+
''',
2325
)
2426

2527

.evergreen/config_generator/components/sanitizers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def tasks():
6161
test_vars = {
6262
'TEST_WITH_CSFLE': 'ON',
6363
'MONGOCXX_TEST_TOPOLOGY': topology,
64-
'example_projects_cc': 'clang',
65-
'example_projects_cxx': 'clang++',
64+
'example_projects_cc': cc_compiler,
65+
'example_projects_cxx': cxx_compiler,
6666
}
6767

6868
if link_type == 'static':
@@ -96,8 +96,8 @@ def tasks():
9696
commands += [
9797
Setup.call(),
9898
StartMongod.call(mongodb_version=mongodb_version, topology=topology),
99-
InstallCDriver.call(),
10099
InstallUV.call(),
100+
InstallCDriver.call(),
101101
Compile.call(vars=compile_vars),
102102
FetchDET.call(),
103103
RunKMSServers.call(),

0 commit comments

Comments
 (0)