Skip to content

Commit 52a8afe

Browse files
[CDRIVER-5881] Remove the "forwarding" headers (#1881)
* [CDRIVER-5881] Remove the "forwarding" headers The "forwarding" headers were added in 1.13.0 to support programs that include "mongoc.h" or "bson.h" directly. We now require that the header names be prefixed with their parent directory name. * Remove tests against C++ driver r3.8.0 This version of the C++ library relies on the presence of the forwarding headers, and is thus incompatible.
1 parent 53f9fec commit 52a8afe

File tree

10 files changed

+18
-229
lines changed

10 files changed

+18
-229
lines changed

.evergreen/config_generator/components/earthly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"Valid options for the SASL configuration parameter"
3939
TLSOption = Literal["LibreSSL", "OpenSSL", "off"]
4040
"Options for the TLS backend configuration parameter (AKA 'ENABLE_SSL')"
41-
CxxVersion = Literal["r3.8.0", "r3.9.0", "none"]
41+
CxxVersion = Literal["r3.9.0", "none"]
4242
"C++ driver refs that are under CI test"
4343

4444
# A separator character, since we cannot use whitespace

.evergreen/generated_configs/tasks.yml

Lines changed: 0 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,46 +1046,6 @@ tasks:
10461046
- name: check-headers
10471047
commands:
10481048
- func: check-headers
1049-
- name: "check:sasl=Cyrus\_\u2022\_tls=LibreSSL\_\u2022\_test_mongocxx_ref=r3.8.0"
1050-
run_on:
1051-
- ubuntu2204-large
1052-
- debian10-large
1053-
- debian11-large
1054-
- amazon2
1055-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc]
1056-
commands:
1057-
- command: subprocess.exec
1058-
type: setup
1059-
params:
1060-
binary: bash
1061-
args:
1062-
- -c
1063-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1064-
- command: subprocess.exec
1065-
type: setup
1066-
params:
1067-
binary: ./tools/earthly.sh
1068-
working_dir: mongoc
1069-
args:
1070-
- +env-warmup
1071-
- --sasl=Cyrus
1072-
- --tls=LibreSSL
1073-
- --test_mongocxx_ref=r3.8.0
1074-
- --env=${MONGOC_EARTHLY_ENV}
1075-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1076-
- command: subprocess.exec
1077-
type: test
1078-
params:
1079-
binary: ./tools/earthly.sh
1080-
working_dir: mongoc
1081-
args:
1082-
- +run
1083-
- --targets=test-example test-cxx-driver
1084-
- --sasl=Cyrus
1085-
- --tls=LibreSSL
1086-
- --test_mongocxx_ref=r3.8.0
1087-
- --env=${MONGOC_EARTHLY_ENV}
1088-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
10891049
- name: "check:sasl=Cyrus\_\u2022\_tls=LibreSSL\_\u2022\_test_mongocxx_ref=r3.9.0"
10901050
run_on:
10911051
- ubuntu2204-large
@@ -1166,46 +1126,6 @@ tasks:
11661126
- --test_mongocxx_ref=none
11671127
- --env=${MONGOC_EARTHLY_ENV}
11681128
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1169-
- name: "check:sasl=Cyrus\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=r3.8.0"
1170-
run_on:
1171-
- ubuntu2204-large
1172-
- debian10-large
1173-
- debian11-large
1174-
- amazon2
1175-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u20-clang, u20-gcc, u22-clang, u22-gcc]
1176-
commands:
1177-
- command: subprocess.exec
1178-
type: setup
1179-
params:
1180-
binary: bash
1181-
args:
1182-
- -c
1183-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1184-
- command: subprocess.exec
1185-
type: setup
1186-
params:
1187-
binary: ./tools/earthly.sh
1188-
working_dir: mongoc
1189-
args:
1190-
- +env-warmup
1191-
- --sasl=Cyrus
1192-
- --tls=OpenSSL
1193-
- --test_mongocxx_ref=r3.8.0
1194-
- --env=${MONGOC_EARTHLY_ENV}
1195-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1196-
- command: subprocess.exec
1197-
type: test
1198-
params:
1199-
binary: ./tools/earthly.sh
1200-
working_dir: mongoc
1201-
args:
1202-
- +run
1203-
- --targets=test-example test-cxx-driver
1204-
- --sasl=Cyrus
1205-
- --tls=OpenSSL
1206-
- --test_mongocxx_ref=r3.8.0
1207-
- --env=${MONGOC_EARTHLY_ENV}
1208-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
12091129
- name: "check:sasl=Cyrus\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=r3.9.0"
12101130
run_on:
12111131
- ubuntu2204-large
@@ -1286,46 +1206,6 @@ tasks:
12861206
- --test_mongocxx_ref=none
12871207
- --env=${MONGOC_EARTHLY_ENV}
12881208
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1289-
- name: "check:sasl=Cyrus\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=r3.8.0"
1290-
run_on:
1291-
- ubuntu2204-large
1292-
- debian10-large
1293-
- debian11-large
1294-
- amazon2
1295-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u20-clang, u20-gcc, u22-clang, u22-gcc]
1296-
commands:
1297-
- command: subprocess.exec
1298-
type: setup
1299-
params:
1300-
binary: bash
1301-
args:
1302-
- -c
1303-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1304-
- command: subprocess.exec
1305-
type: setup
1306-
params:
1307-
binary: ./tools/earthly.sh
1308-
working_dir: mongoc
1309-
args:
1310-
- +env-warmup
1311-
- --sasl=Cyrus
1312-
- --tls=off
1313-
- --test_mongocxx_ref=r3.8.0
1314-
- --env=${MONGOC_EARTHLY_ENV}
1315-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1316-
- command: subprocess.exec
1317-
type: test
1318-
params:
1319-
binary: ./tools/earthly.sh
1320-
working_dir: mongoc
1321-
args:
1322-
- +run
1323-
- --targets=test-example test-cxx-driver
1324-
- --sasl=Cyrus
1325-
- --tls=off
1326-
- --test_mongocxx_ref=r3.8.0
1327-
- --env=${MONGOC_EARTHLY_ENV}
1328-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
13291209
- name: "check:sasl=Cyrus\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=r3.9.0"
13301210
run_on:
13311211
- ubuntu2204-large
@@ -1366,46 +1246,6 @@ tasks:
13661246
- --test_mongocxx_ref=r3.9.0
13671247
- --env=${MONGOC_EARTHLY_ENV}
13681248
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1369-
- name: "check:sasl=off\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=r3.8.0"
1370-
run_on:
1371-
- ubuntu2204-large
1372-
- debian10-large
1373-
- debian11-large
1374-
- amazon2
1375-
tags: [earthly, pr-merge-gate, u22-gcc]
1376-
commands:
1377-
- command: subprocess.exec
1378-
type: setup
1379-
params:
1380-
binary: bash
1381-
args:
1382-
- -c
1383-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1384-
- command: subprocess.exec
1385-
type: setup
1386-
params:
1387-
binary: ./tools/earthly.sh
1388-
working_dir: mongoc
1389-
args:
1390-
- +env-warmup
1391-
- --sasl=off
1392-
- --tls=OpenSSL
1393-
- --test_mongocxx_ref=r3.8.0
1394-
- --env=${MONGOC_EARTHLY_ENV}
1395-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1396-
- command: subprocess.exec
1397-
type: test
1398-
params:
1399-
binary: ./tools/earthly.sh
1400-
working_dir: mongoc
1401-
args:
1402-
- +run
1403-
- --targets=test-example test-cxx-driver
1404-
- --sasl=off
1405-
- --tls=OpenSSL
1406-
- --test_mongocxx_ref=r3.8.0
1407-
- --env=${MONGOC_EARTHLY_ENV}
1408-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
14091249
- name: clang-format
14101250
tags: [clang-format]
14111251
commands:

.evergreen/scripts/install-uninstall-check.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ if test -f $INSTALL_DIR/include/libbson-1.0/bson/bson.h; then
161161
else
162162
echo "bson/bson.h check ok"
163163
fi
164-
if test -f $INSTALL_DIR/include/libbson-1.0/bson.h; then
165-
echo "bson.h found!"
166-
exit 1
167-
else
168-
echo "bson.h check ok"
169-
fi
170164
if test -d $INSTALL_DIR/include/libbson-1.0; then
171165
echo "$INSTALL_DIR/include/libbson-1.0 found!"
172166
exit 1
@@ -180,12 +174,6 @@ if [ -z "$BSON_ONLY" ]; then
180174
else
181175
echo "mongoc/mongoc.h check ok"
182176
fi
183-
if test -f $INSTALL_DIR/include/libmongoc-1.0/mongoc.h; then
184-
echo "mongoc.h found!"
185-
exit 1
186-
else
187-
echo "mongoc.h check ok"
188-
fi
189177
if test -d $INSTALL_DIR/include/libmongoc-1.0; then
190178
echo "$INSTALL_DIR/include/libmongoc-1.0 found!"
191179
exit 1

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Unreleased (2.0.0)
2+
==================
3+
4+
Removals:
5+
6+
* The compatibility "forwarding" headers have been removed (previously added
7+
in 1.13.0). This means it is no longer valid to include the literal header
8+
names `mongoc.h` or `bson.h` directly. Instead, the names must be prefixed
9+
with the parent directory: `mongoc/mongoc.h` and `bson/bson.h`.
10+
111
libmongoc 1.30.0
212
================
313

@@ -1477,6 +1487,7 @@ Features:
14771487
and all bson headers are under bson/. The preferred way of including the
14781488
headers are mongoc/mongoc.h and bson/bson.h respectively.
14791489
Forwarding headers in the root are provided for backwards compatibility.
1490+
(**Update**: These headers were removed in the 2.0 release)
14801491
* The default CMake build type had been unspecified, now it is RelWithDebInfo.
14811492
* Support LibreSSL 2.7+.
14821493

src/libbson/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,10 @@ install(
359359
FILES_MATCHING
360360
PATTERN "*.h"
361361
PATTERN "*-private.h" EXCLUDE
362-
# Installed separately below:
363-
PATTERN "forwarding" EXCLUDE
364362
# Don't generate an empty "modules" directory
365363
PATTERN "modules" EXCLUDE
366364
)
367365

368-
# The forwarding header is for compatibility with `#include <bson.h>`, so it goes at the top-level:
369-
install(FILES src/bson/forwarding/bson.h DESTINATION "${BSON_HEADER_INSTALL_DIR}")
370-
371366
if (ENABLE_APPLE_FRAMEWORK)
372367
install (
373368
FILES "${PROJECT_BINARY_DIR}/src/bson/modules/module.modulemap"

src/libbson/src/bson/forwarding/bson.h

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
framework module bson [system] {
2-
umbrella header "bson.h"
3-
2+
umbrella header "bson/bson.h"
3+
44
export *
55
}

src/libmongoc/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -780,10 +780,6 @@ set (HEADERS
780780
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-bulkwrite.h
781781
)
782782

783-
set (HEADERS_FORWARDING
784-
${PROJECT_SOURCE_DIR}/src/mongoc/forwarding/mongoc.h
785-
)
786-
787783
configure_file (
788784
"${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-config.h.in"
789785
"${PROJECT_BINARY_DIR}/src/mongoc/mongoc-config.h"
@@ -899,7 +895,7 @@ set (
899895
)
900896

901897
if (ENABLE_SHARED)
902-
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
898+
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS})
903899
if(WIN32)
904900
# Add resource-definition script for Windows shared library (.dll).
905901
configure_file(libmongoc.rc.in libmongoc.rc)
@@ -976,7 +972,7 @@ if (ENABLE_SHARED)
976972
endif () # ENABLE_SHARED
977973

978974
if (MONGOC_ENABLE_STATIC_BUILD)
979-
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
975+
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS})
980976
target_link_libraries (mongoc_static PUBLIC ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES} mongo::detail::c_dependencies)
981977
if (NOT WIN32 AND ENABLE_PIC)
982978
target_compile_options (mongoc_static PUBLIC -fPIC)
@@ -1397,11 +1393,6 @@ install (
13971393
DESTINATION "${MONGOC_HEADER_INSTALL_DIR}/mongoc"
13981394
)
13991395

1400-
install (
1401-
FILES ${HEADERS_FORWARDING}
1402-
DESTINATION "${MONGOC_HEADER_INSTALL_DIR}"
1403-
)
1404-
14051396
if (ENABLE_APPLE_FRAMEWORK)
14061397
install (
14071398
FILES "${PROJECT_BINARY_DIR}/src/mongoc/modules/module.modulemap"

src/libmongoc/src/mongoc/forwarding/mongoc.h

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
framework module mongoc {
2-
umbrella header "mongoc.h"
3-
2+
umbrella header "mongoc/mongoc.h"
3+
44
export *
55
}

0 commit comments

Comments
 (0)