Skip to content

Commit

Permalink
Upgrade windows-rs to version 0.57 (#43)
Browse files Browse the repository at this point in the history
windows-rs version 0.57 has various improvements for generated com
bindings and the code size reduces.

We have been using win-bindgen with config=package, which is not
publicly supported, and we are advised to switch to config=implement
that is supported external to windows-rs. See
microsoft/windows-rs#3100 for details.

The generated code are reorganized due to the generation config mode,
and the mod structures are remapped so that there is no unwanted nesting
of mods, for example, FabricRuntime is no longer inside FabricCommon but
they are siblings now. The generation of the code and remapping of the
mods are still hacky, and we still need
Azure/service-fabric-metadata#1 to improve
this.

Previously all mods are generated once, but now, each mod like
FabricCommon and FabricRuntime is generated separately from the winmd
file per pass. The generation speed maybe slowed but in practice it is
not observable.

This upgrade will cause break in down stream because of the mod layout
change. But it is easy to fix: just change the imports(use) with
different path.
  • Loading branch information
youyuanwu authored Jun 28, 2024
1 parent ccac666 commit cce27f7
Show file tree
Hide file tree
Showing 54 changed files with 33,800 additions and 51,383 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ find_program (

add_custom_target(generate_rust
COMMAND ${cargo_exe} run -p tools_api
COMMAND ${cargo_exe} fmt -p mssf-com # format the generated crate
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

Expand Down
41 changes: 20 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ members = [

[workspace.dependencies]
tracing = { version = "0.1.40", features = ["log"] }
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt"]}
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt"]}
15 changes: 2 additions & 13 deletions crates/libs/com/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,11 @@ mssf-metadata = "0.0.1"
mssf-pal = { path = "../pal" , version = "0.0.6"}

[dependencies]
windows-core = "0.56"
windows-core = "0.57"

[dependencies.windows]
version = "0.56"
version = "0.57"
features = [
"Win32_Foundation",
"implement"
]

[features]
implement = []
Foundation = []
Win32_Foundation = []
# generated features
ServiceFabric = ["Foundation"]
ServiceFabric_FabricCommon = ["ServiceFabric"]
ServiceFabric_FabricCommon_FabricClient = ["ServiceFabric_FabricCommon"]
ServiceFabric_FabricCommon_FabricRuntime = ["ServiceFabric_FabricCommon"]
ServiceFabric_FabricCommon_FabricTransport = ["ServiceFabric_FabricCommon"]
1 change: 0 additions & 1 deletion crates/libs/com/features.json

This file was deleted.

1 change: 0 additions & 1 deletion crates/libs/com/rustfmt.toml

This file was deleted.

Loading

0 comments on commit cce27f7

Please sign in to comment.