Skip to content

Fix OSGi :mongodb-crypt manifest entries #1506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driver-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ afterEvaluate {
'com.github.luben.zstd.*;resolution:=optional',
'org.slf4j.*;resolution:=optional',
'jnr.unixsocket.*;resolution:=optional',
'com.mongodb.crypt.capi.*;resolution:=optional',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

driver-core doesn't reference MongoCryptException (the only class left in this package), so this needed to be removed or else we get a warning.

'com.mongodb.internal.crypt.capi.*;resolution:=optional',
'jdk.net.*;resolution:=optional', // Used by SocketStreamHelper & depends on JDK version
'org.bson.codecs.record.*;resolution:=optional', // Depends on JDK version
'org.bson.codecs.kotlin.*;resolution:=optional',
Expand Down
1 change: 1 addition & 0 deletions driver-reactive-streams/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ afterEvaluate {
jar.manifest.attributes['Bundle-SymbolicName'] = 'org.mongodb.driver-reactivestreams'
jar.manifest.attributes['Import-Package'] = [
'com.mongodb.crypt.capi.*;resolution:=optional',
'com.mongodb.internal.crypt.capi.*;resolution:=optional',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reactive-streams (and sync) reference MongoCryptException, and also the classes that were moved into the internal package, so both packages are now needed.

'*',
].join(',')
}
1 change: 1 addition & 0 deletions driver-sync/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ afterEvaluate {
jar.manifest.attributes['Bundle-SymbolicName'] = 'org.mongodb.driver-sync'
jar.manifest.attributes['Import-Package'] = [
'com.mongodb.crypt.capi.*;resolution:=optional',
'com.mongodb.internal.crypt.capi.*;resolution:=optional',
'*',
].join(',')
}
2 changes: 1 addition & 1 deletion mongodb-crypt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ afterEvaluate {
tasks.jar {
manifest {
attributes(
"-exportcontents" to "com.mongodb.crypt.capi.*;-noimport:=true",
"-exportcontents" to "com.mongodb.*;-noimport:=true",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a weird one. driver-core uses * for this, but * causes a warning with mongodb-crypt because the jar file contains directories for each of the shared library files, and some of those (e.g. linux-aarch64) are not valid Java package names. Using com.mongodb.* does the trick (it could also just be com.*).

"Automatic-Module-Name" to "com.mongodb.crypt.capi",
"Import-Package" to "org.slf4j.*;resolution:=optional,org.bson.*",
"Bundle-Name" to "MongoCrypt",
Expand Down