Skip to content
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

Use "fosskers/rs-versions" to determine the latest CRT and SDK versions. #67

Merged
merged 1 commit into from
Nov 30, 2022
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
36 changes: 36 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [
] }
# Hashing
twox-hash = "1.6"
# Determine the latest CRT and SDK versions
versions = "4.1.0"
# Unpacking of VSIX "packages"
zip = { version = "0.6", default-features = false, features = ["deflate"] }

Expand Down
18 changes: 13 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,17 @@ fn get_crt(
.get("Microsoft.VisualStudio.Product.BuildTools")
.context("unable to find root BuildTools item")?;

let crt_version = build_tools
let crt_version_rs_versions = build_tools
.dependencies
.keys()
.filter_map(|key| {
key.strip_prefix("Microsoft.VisualStudio.Component.VC.")
.and_then(|s| s.strip_suffix(".x86.x64"))
.and_then(versions::Version::new)
})
.last()
.max()
.context("unable to find latest CRT version")?;
let crt_version = &crt_version_rs_versions.to_string();

// The CRT headers are in the "base" package
// `Microsoft.VC.<ridiculous_version_numbers>.CRT.Headers.base`
Expand Down Expand Up @@ -519,11 +521,17 @@ fn get_sdk(
arches: u32,
pruned: &mut Vec<Payload>,
) -> Result<(), Error> {
let sdk = pkgs
.values()
.filter(|mi| mi.id.starts_with("Win10SDK_10."))
let sdk_version_rs_versions = pkgs
.keys()
.filter_map(|key| {
key.strip_prefix("Win10SDK_")
.and_then(versions::Version::new)
})
.max()
.context("unable to find latest Win10SDK version")?;
let sdk = pkgs
.get(&format!("Win10SDK_{sdk_version_rs_versions}"))
.unwrap();

// So. There are multiple SDK Desktop Headers, one per architecture. However,
// all of the non-x86 ones include either 0 or few files, with x86 containing
Expand Down