Skip to content

Commit 54112b0

Browse files
authored
CXX-2681 Use split min and max setters for RangeOpts (#957)
* Update minimum C Driver version to 11e31e3e (1.24.0) * CXX-2681 Use separate min and max setters for range opts * Remove unused/outdated flags to make_release.py
1 parent 3670e0b commit 54112b0

File tree

5 files changed

+23
-40
lines changed

5 files changed

+23
-40
lines changed

.mci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#######################################
88
variables:
99

10-
mongoc_version_default: &mongoc_version_default "8aced03a" # TODO: update to 1.24.0 once released.
10+
mongoc_version_default: &mongoc_version_default "11e31e3e" # TODO: update to 1.24.0 once released.
1111

1212
# If updating mongoc_version_minimum, also update:
1313
# - the default value of --c-driver-build-ref in etc/make_release.py
1414
# - LIBMONGOC_REQUIRED_VERSION in src/mongocxx/CMakeLists.txt
15-
mongoc_version_minimum: &mongoc_version_minimum "8aced03a" # TODO: update to 1.24.0 once released.
15+
mongoc_version_minimum: &mongoc_version_minimum "11e31e3e" # TODO: update to 1.24.0 once released.
1616

1717
mongodb_version:
1818
version_latest: &version_latest "latest"

etc/make_release.py

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,10 @@
8383
default='origin',
8484
show_default=True,
8585
help='The remote reference which points to the mongodb/mongo-cxx-driver repo')
86-
@click.option('--c-driver-install-dir',
87-
default=os.getcwd() + '/../mongoc',
88-
show_default=True,
89-
help='When building the C driver and libmongocrypt, install to this directory')
9086
@click.option('--c-driver-build-ref',
91-
default='1.22.1',
87+
default='11e31e3e',
9288
show_default=True,
9389
help='When building the C driver, build at this Git reference')
94-
@click.option('--mongocrypt-build-ref',
95-
default='1.5.2',
96-
show_default=True,
97-
help='When building libmongocrypt, build at this Git reference')
9890
@click.option('--with-c-driver',
9991
help='Instead of building the C driver, use the one installed at this path')
10092
@click.option('--dist-file',
@@ -119,9 +111,7 @@ def release(jira_creds_file,
119111
github_token_file,
120112
allow_open_issues,
121113
remote,
122-
c_driver_install_dir,
123114
c_driver_build_ref,
124-
mongocrypt_build_ref,
125115
with_c_driver,
126116
dist_file,
127117
skip_distcheck,
@@ -180,7 +170,7 @@ def release(jira_creds_file,
180170
click.echo('Specified distribution tarball does not exist...exiting!', err=True)
181171
sys.exit(1)
182172
else:
183-
c_driver_dir = ensure_c_driver(c_driver_install_dir, c_driver_build_ref, mongocrypt_build_ref, with_c_driver, quiet)
173+
c_driver_dir = ensure_c_driver(c_driver_build_ref, with_c_driver, quiet)
184174
if not c_driver_dir:
185175
click.echo('C driver not built or not found...exiting!', err=True)
186176
sys.exit(1)
@@ -331,14 +321,13 @@ def check_pre_release(tag_name):
331321

332322
return not bool(release_re.match(tag_name))
333323

334-
def ensure_c_driver(c_driver_install_dir, c_driver_build_ref, mongocrypt_build_ref, with_c_driver, quiet):
324+
def ensure_c_driver(c_driver_build_ref, with_c_driver, quiet):
335325
"""
336326
Ensures that there is a properly installed C driver, returning the location
337327
of the C driver installation. If the with_c_driver parameter is set and
338328
points to a proper installation of the C driver, then this function simply
339329
returns that directory. Otherwise, delegates to another function to build
340-
the C driver and install it to the directory specified by the
341-
c_driver_install_dir parameter.
330+
the C driver and install it to the mongoc directory.
342331
"""
343332

344333
if with_c_driver:
@@ -350,32 +339,27 @@ def ensure_c_driver(c_driver_install_dir, c_driver_build_ref, mongocrypt_build_r
350339
click.echo('A required component of the C driver is missing!', err=True)
351340
return None
352341

353-
return build_c_driver(c_driver_install_dir, c_driver_build_ref, mongocrypt_build_ref, quiet)
342+
return build_c_driver(c_driver_build_ref, quiet)
354343

355-
def build_c_driver(c_driver_install_dir, c_driver_build_ref, mongocrypt_build_ref, quiet):
344+
def build_c_driver(c_driver_build_ref, quiet):
356345
"""
357-
Build the C driver and install to the specified directory. If the build is
346+
Build the C driver and install to the mongoc directory. If the build is
358347
successful, then return the directory where the C driver was installed,
359348
otherwise return None.
360349
"""
361350

362-
mongoc_prefix = os.path.abspath(c_driver_install_dir)
363-
364351
if not quiet:
365-
click.echo(f'Building C Driver at {mongoc_prefix} (this could take several minutes)')
352+
click.echo(f'Building C Driver (this could take several minutes)')
366353
click.echo('Pass --with-c-driver to use an existing installation')
367354

368355
env = os.environ.copy()
369-
env['PREFIX'] = mongoc_prefix
370-
env['MONGOC_VERSION'] = c_driver_build_ref
371-
env['MONGOCRYPT_VERSION'] = mongocrypt_build_ref
356+
env['mongoc_version'] = c_driver_build_ref
372357
run_shell_script('./.evergreen/install_c_driver.sh', env=env)
373358

374359
if not quiet:
375-
click.echo('C Driver build was successful.')
376-
click.echo('Version "{}" was installed to "{}".'
377-
.format(c_driver_build_ref, mongoc_prefix))
378-
return mongoc_prefix
360+
click.echo('Build of C Driver version "{}" was successful.'.format(c_driver_build_ref))
361+
362+
return './mongoc'
379363

380364
def build_distribution(release_tag, release_version, c_driver_dir, quiet, skip_distcheck):
381365
"""

src/mongocxx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ message ("mongocxx version: ${MONGOCXX_VERSION}")
2929
set(MONGOCXX_INLINE_NAMESPACE "v${MONGOCXX_ABI_VERSION}")
3030
set(MONGOCXX_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/${MONGOCXX_INLINE_NAMESPACE}" CACHE INTERNAL "")
3131

32-
set(LIBMONGOC_REQUIRED_VERSION 1.22.1)
32+
set(LIBMONGOC_REQUIRED_VERSION 1.22.1) # TODO: update to 1.24.0 once released.
3333
set(LIBMONGOC_REQUIRED_ABI_VERSION 1.0)
3434

3535
set(mongocxx_pkg_dep "")

src/mongocxx/options/encrypt.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,14 @@ void* encrypt::convert() const {
232232
const auto& precision = _range_opts->precision();
233233
const auto& sparsity = _range_opts->sparsity();
234234

235-
if (!!min != !!max) {
236-
throw exception{error_code::k_invalid_parameter,
237-
"one of min or max was set without the other"};
235+
if (min) {
236+
libmongoc::client_encryption_encrypt_range_opts_set_min(
237+
range_opts, scoped_bson_value(min->view()).get());
238238
}
239239

240-
if (min && max) {
241-
libmongoc::client_encryption_encrypt_range_opts_set_min_max(
242-
range_opts,
243-
scoped_bson_value(min->view()).get(),
244-
scoped_bson_value(max->view()).get());
240+
if (max) {
241+
libmongoc::client_encryption_encrypt_range_opts_set_max(
242+
range_opts, scoped_bson_value(max->view()).get());
245243
}
246244

247245
if (precision) {

src/mongocxx/private/libmongoc_symbols.hh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_opts_set_query_type)
146146
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_opts_set_range_opts)
147147
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_destroy)
148148
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_new)
149-
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_set_min_max)
149+
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_set_min)
150+
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_set_max)
150151
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_set_precision)
151152
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_encrypt_range_opts_set_sparsity)
152153
MONGOCXX_LIBMONGOC_SYMBOL(client_encryption_get_key)

0 commit comments

Comments
 (0)