Skip to content

Commit

Permalink
move from xz to zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
danielschemmel committed Oct 9, 2023
1 parent a8523c0 commit 2b7f82c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build-info-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ glob = "0.3"
pretty_assertions = "1"
rustc_version = "0.4"
serde_json = "1"
xz2 = "0.1"
zstd = "0.12"

build-info-common = { version = "=0.0.33", path = "../build-info-common", features = ["serde"] }

Expand Down
3 changes: 1 addition & 2 deletions build-info-build/src/build_script_options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::path::{Path, PathBuf};
use base64::write::EncoderWriter as Base64Encoder;
use build_info_common::{OptimizationLevel, VersionedString};
use chrono::{DateTime, Utc};
use xz2::write::XzEncoder;

pub use self::crate_info::DependencyDepth;
use super::BuildInfo;
Expand Down Expand Up @@ -79,7 +78,7 @@ impl BuildScriptOptions {
.with_decode_padding_mode(base64::engine::DecodePaddingMode::Indifferent),
);
let string_safe = Base64Encoder::new(&mut bytes, &BASE64_ENGINE);
let mut compressed = XzEncoder::new(string_safe, 9);
let mut compressed = zstd::Encoder::new(string_safe, 22).expect("Could not create ZSTD encoder");
bincode::serialize_into(&mut compressed, &build_info).unwrap();
compressed.finish().unwrap().finish().unwrap();

Expand Down
2 changes: 1 addition & 1 deletion build-info-proc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ proc-macro-error = "1"
quote = "1"
serde_json = "1"
syn = "2"
xz2 = "0.1"
zstd = "0.12"

build-info-common = { version = "=0.0.33", path = "../build-info-common", features = ["serde"] }

Expand Down
3 changes: 1 addition & 2 deletions build-info-proc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use base64::read::DecoderReader as Base64Decoder;
use build_info_common::{BuildInfo, VersionedString};
use proc_macro::TokenStream;
use proc_macro_error::{abort_call_site, emit_call_site_error, proc_macro_error};
use xz2::read::XzDecoder;

mod format;
#[cfg(feature = "runtime")]
Expand Down Expand Up @@ -68,7 +67,7 @@ fn deserialize_build_info() -> BuildInfo {
.with_decode_padding_mode(base64::engine::DecodePaddingMode::Indifferent),
);
let string_safe = Base64Decoder::new(&mut cursor, &BASE64_ENGINE);
let decoder = XzDecoder::new(string_safe);
let decoder = zstd::Decoder::new(string_safe).expect("Could not crate ZSTD decoder");
bincode::deserialize_from(decoder).unwrap_or_else(|err| {
abort_call_site!("BuildInfo data cannot be deserialized!";
note = "The serialized data has version {}", versioned.version;
Expand Down

0 comments on commit 2b7f82c

Please sign in to comment.