Skip to content

Reduce duplicate dependencies on windows-sys and windows-targets#6516

Draft
mgoldenberg wants to merge 2 commits into
matrix-org:mainfrom
mgoldenberg:reduce-dup-deps-on-windows-sys-targets
Draft

Reduce duplicate dependencies on windows-sys and windows-targets#6516
mgoldenberg wants to merge 2 commits into
matrix-org:mainfrom
mgoldenberg:reduce-dup-deps-on-windows-sys-targets

Conversation

@mgoldenberg

@mgoldenberg mgoldenberg commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Since merging #6053, some duplicates of windows-sys and windows-targets could be attributed to rustls-platform-verifier using an outdated version of jni. As of rustls-platform-verifier@0.7.0, however, it uses the latest version of jni. So, this pull request aims to reduce those duplicates by updating rustls-platform-verifier.

Changes

  • Bump reqwest to 0.13.3 at the workspace level
    • reqwest is the primary way in which rustls-platform-verifier enters the repository as a dependency.
  • Bump rustls-platform-verifier to 0.7.0 in matrix-sdk-ffi
    • This also means it is possible to remove the explicit dependency on jni in matrix-sdk-ffi.

Results

Updating reqwest and rustls-platform-verifier does indeed remove one of the duplicates in each of windows-sys and windows-targets, but it adds a duplicate version of jni-sys (see below).

Removing the duplicate of jni-sys would be somewhat difficult, as the crates which depend on it don't seem to be under active development - i.e., jvm-getter and paranoid-android.

I am not sure whether this outcome is preferable, but I will leave that to the reviewer to decide.

main

Note that there are 6 versions of windows-sys, 4 versions of windows-targets, and 1 version of jni-sys.

> cargo tree --workspace --all-features --target=all --invert windows-sys
error: There are multiple `windows-sys` packages in your project, and the specification `windows-sys` is ambiguous.
Please re-run this command with one of the following specifications:
  windows-sys@0.45.0
  windows-sys@0.48.0
  windows-sys@0.52.0
  windows-sys@0.59.0
  windows-sys@0.60.2
  windows-sys@0.61.2
> cargo tree --workspace --all-features --target=all --invert windows-targets
error: There are multiple `windows-targets` packages in your project, and the specification `windows-targets` is ambiguous.
Please re-run this command with one of the following specifications:
  windows-targets@0.42.2
  windows-targets@0.48.5
  windows-targets@0.52.6
  windows-targets@0.53.5
> cargo tree --workspace --all-features --target=all --invert jni-sys --depth 0
jni-sys v0.3.0

reduce-dup-deps-on-windows-sys-targets

Note that there are 5 versions of windows-sys, 3 versions of windows-targets, and 2 version of jni-sys.

> cargo tree --workspace --all-features --target=all --invert windows-sys
error: There are multiple `windows-sys` packages in your project, and the specification `windows-sys` is ambiguous.
Please re-run this command with one of the following specifications:
  windows-sys@0.48.0
  windows-sys@0.52.0
  windows-sys@0.59.0
  windows-sys@0.60.2
  windows-sys@0.61.2
> cargo tree --workspace --all-features --target=all --invert windows-targets
error: There are multiple `windows-targets` packages in your project, and the specification `windows-targets` is ambiguous.
Please re-run this command with one of the following specifications:
  windows-targets@0.48.5
  windows-targets@0.52.6
  windows-targets@0.53.5
> cargo tree --workspace --all-features --target=all --invert jni-sys
error: There are multiple `jni-sys` packages in your project, and the specification `jni-sys` is ambiguous.
Please re-run this command with one of the following specifications:
  jni-sys@0.3.0
  jni-sys@0.4.1

Closes #6238.

  • I've documented the public API Changes in the appropriate CHANGELOG.md files.
  • This PR was made with the help of AI.

Signed-off-by: Michael Goldenberg m@mgoldenberg.net

Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.90%. Comparing base (b31e0f0) to head (19f7d60).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6516   +/-   ##
=======================================
  Coverage   89.89%   89.90%           
=======================================
  Files         381      381           
  Lines      105750   105750           
  Branches   105750   105750           
=======================================
+ Hits        95066    95074    +8     
  Misses       7032     7032           
+ Partials     3652     3644    -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented Apr 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing mgoldenberg:reduce-dup-deps-on-windows-sys-targets (19f7d60) with main (1136eb4)

Open in CodSpeed

[target.'cfg(target_os = "android")'.dependencies]
paranoid-android = { version = "0.2.2", default-features = false }
# Needed for `rustls-platform-verifier`. Newer versions aren't compatible with it.
jni = "0.21.1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We still need this for the Android bindings:

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `jni`
 --> bindings/matrix-sdk-ffi/src/platform/android_platform.rs:3:5
  |
3 | use jni::{
  |     ^^^ use of unresolved module or unlinked crate `jni`
  |
  = help: if you wanted to use a crate named `jni`, use `cargo add jni` to add it to your `Cargo.toml`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

... and we can't upgrade to jni 0.22.x because jvm-getter doesn't support it 🫠

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Too bad... 😭

I guess this will have to wait? Unless we can replace jvm-getter with something else?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think there's anything to replace it with... We could either contribute to it by updating their code so they use jni 0.22.x or maybe include the contents of the crate's lib.rs and android.rs files in the FFI layer and fix the incompatibilities there.

@poljar , @Hywan : WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Status update: An PR was opened to attempt to update upstream: gobley/jvm-getter#14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce duplicate dependencies on windows-sys and windows-targets

3 participants