Skip to content
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
915 changes: 364 additions & 551 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ crossbeam-channel = "0.5"
# Pretty progress bars
indicatif = "0.18"
# Decoding of MSI installer packages
msi = "0.9"
msi = "0.10"
parking_lot = "0.12"
# brrr
rayon = "1.5"
# Include scanning
regex = "1.11"
memchr = "2.6"
# SHA-256 verification
sha2 = "0.10"
sha2 = "0.11"
# Deserialization
serde = { version = "1.0", features = ["derive"] }
# JSON deserialization
Expand All @@ -53,7 +53,7 @@ serde_json = "1.0"
clap = { version = "4.5", features = ["derive", "env", "wrap_help"] }
# Easy management of temp files
tempfile = "3.19"
toml = "0.9"
toml = "1.1"
# Tracing logs
tracing = { version = "0.1", default-features = false, features = [
"attributes",
Expand All @@ -66,7 +66,7 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [
"json",
] }
# Hashing
twox-hash = "2.1"
twox-hash = { version = "2.1", default-features = false, features = ["xxhash64"] }
# Determine the latest CRT and SDK versions
versions = "7.0"
walkdir = "2.3"
Expand Down
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exceptions = [
multiple-versions = "deny"
deny = []
skip = [
{ crate = "getrandom@0.2.17", reason = "ring use this old version, lol" },
{ crate = "getrandom@0.2.17", reason = "ring use this old version" },
]
skip-tree = []

Expand Down
6 changes: 2 additions & 4 deletions src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,8 @@ impl Ctx {
emit("sdk headers", results.sdk_headers);
emit("sdk libs", results.sdk_libs);
}
crate::Ops::Splat(_config) => {
if map.is_none() {
splat_links()?;
}
crate::Ops::Splat(_config) if map.is_none() => {
splat_links()?;
}
_ => {}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub struct Args {
manifest: Option<PathBuf>,
/// The manifest version to retrieve
#[arg(long, default_value = "17")]
manifest_version: String,
manifest_version: u8,
/// The product channel to use.
#[arg(long, default_value = "release")]
channel: String,
Expand Down Expand Up @@ -315,7 +315,7 @@ fn main() -> Result<(), Error> {
let pkg_manifest = load_manifest(
&ctx,
args.manifest.as_ref(),
&args.manifest_version,
args.manifest_version,
&args.channel,
draw_target,
)?;
Expand Down Expand Up @@ -525,7 +525,7 @@ fn print_packages(payloads: &[xwin::Payload]) {
fn load_manifest(
ctx: &xwin::Ctx,
manifest: Option<&PathBuf>,
manifest_version: &str,
manifest_version: u8,
channel: &str,
dt: xwin::util::ProgressTarget,
) -> anyhow::Result<xwin::manifest::PackageManifest> {
Expand Down
26 changes: 17 additions & 9 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,26 @@ pub struct Manifest {
/// link to the actual package manifest which describes all of the contents
pub fn get_manifest(
ctx: &Ctx,
version: &str,
channel: &str,
version: u8,
mut channel: &str,
progress: indicatif::ProgressBar,
) -> Result<Manifest, anyhow::Error> {
let manifest_bytes = ctx.get_and_validate(
format!("https://aka.ms/vs/{version}/{channel}/channel"),
&format!("manifest_{version}.json"),
None,
progress,
)?;
// MS gonna MS
if version >= 18 {
if channel == "release" {
channel = "stable";
} else if channel == "pre" {
channel = "insiders";
}
}

let url = format!("https://aka.ms/vs/{version}/{channel}/channel");

let manifest_bytes =
ctx.get_and_validate(&url, &format!("manifest_{version}.json"), None, progress)?;

let manifest: Manifest = serde_json::from_slice(&manifest_bytes)?;
let manifest: Manifest = serde_json::from_slice(&manifest_bytes)
.with_context(|| format!("failed to deserialize manifest from {url}"))?;

Ok(manifest)
}
Expand Down
4 changes: 2 additions & 2 deletions src/unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub(crate) fn unpack(
}

// They are usually always sorted correctly, but you never know
cab_contents.sort_by(|a, b| a.sequence.cmp(&b.sequence));
cab_contents.sort_by_key(|a| a.sequence);
cab_contents
};

Expand Down Expand Up @@ -436,7 +436,7 @@ pub(crate) fn unpack(
.collect::<Result<Vec<_>, Error>>()
.with_context(|| format!("unable to read 'File' metadata for {pkg}"))?;

files.sort_by(|a, b| a.sequence.cmp(&b.sequence));
files.sort_by_key(|a| a.sequence);

(files, uncompressed)
};
Expand Down
44 changes: 14 additions & 30 deletions tests/compiles.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
fn manifest_version() -> u8 {
// TODO: Bump to CI to 17 once github actions isn't using an ancient version,
// we could install in the action run, but not really worth it since I can
// test locally
if std::env::var_os("CI").is_some() {
16
} else {
18
}
}

#[test]
fn verify_compiles() {
let ctx = xwin::Ctx::with_dir(
Expand All @@ -12,17 +23,8 @@ fn verify_compiles() {

let hidden = indicatif::ProgressBar::hidden();

// TODO: Bump to CI to 17 once github actions isn't using an ancient version,
// we could install in the action run, but not really worth it since I can
// test locally
let manifest_version = if std::env::var_os("CI").is_some() {
"16"
} else {
"17"
};

let manifest =
xwin::manifest::get_manifest(&ctx, manifest_version, "release", hidden.clone()).unwrap();
xwin::manifest::get_manifest(&ctx, manifest_version(), "release", hidden.clone()).unwrap();
let pkg_manifest =
xwin::manifest::get_package_manifest(&ctx, &manifest, hidden.clone()).unwrap();

Expand Down Expand Up @@ -182,17 +184,8 @@ fn verify_compiles_minimized() {

let hidden = indicatif::ProgressBar::hidden();

// TODO: Bump to CI to 17 once github actions isn't using an ancient version,
// we could install in the action run, but not really worth it since I can
// test locally
let manifest_version = if std::env::var_os("CI").is_some() {
"16"
} else {
"17"
};

let manifest =
xwin::manifest::get_manifest(&ctx, manifest_version, "release", hidden.clone()).unwrap();
xwin::manifest::get_manifest(&ctx, manifest_version(), "release", hidden.clone()).unwrap();
let pkg_manifest =
xwin::manifest::get_package_manifest(&ctx, &manifest, hidden.clone()).unwrap();

Expand Down Expand Up @@ -305,17 +298,8 @@ fn verify_compiles_aarch64() {

let hidden = indicatif::ProgressBar::hidden();

// TODO: Bump to CI to 17 once github actions isn't using an ancient version,
// we could install in the action run, but not really worth it since I can
// test locally
let manifest_version = if std::env::var_os("CI").is_some() {
"16"
} else {
"17"
};

let manifest =
xwin::manifest::get_manifest(&ctx, manifest_version, "release", hidden.clone()).unwrap();
xwin::manifest::get_manifest(&ctx, manifest_version(), "release", hidden.clone()).unwrap();
let pkg_manifest =
xwin::manifest::get_package_manifest(&ctx, &manifest, hidden.clone()).unwrap();

Expand Down
Loading