diff --git a/Cargo.lock b/Cargo.lock index af3a7e682..5cae922ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -223,16 +223,11 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" dependencies = [ - "bzip2", - "deflate64", "flate2", "futures-core", "futures-io", "memchr", "pin-project-lite", - "xz2", - "zstd 0.13.0", - "zstd-safe 7.0.0", ] [[package]] @@ -344,13 +339,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527207465fb6dcafbf661b0d4a51d0d2306c9d0c2975423079a6caa807930daf" dependencies = [ "async-compression", - "chrono", "crc32fast", "futures-lite 2.2.0", "pin-project", "thiserror", - "tokio", - "tokio-util", ] [[package]] @@ -1082,12 +1074,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "deflate64" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9576c1de19747eb6f5efb6a806c3e836512bbdb17bfedc984ccb0bcc953c8390" - [[package]] name = "derive-getters" version = "0.2.0" @@ -2205,17 +2191,6 @@ dependencies = [ "value-bag", ] -[[package]] -name = "lzma-sys" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "matchers" version = "0.1.0" @@ -4049,7 +4024,6 @@ checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes 1.1.0", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", @@ -4910,15 +4884,6 @@ dependencies = [ "fs-err", ] -[[package]] -name = "xz2" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" -dependencies = [ - "lzma-sys", -] - [[package]] name = "yansi" version = "0.5.1" @@ -4948,7 +4913,7 @@ dependencies = [ "pbkdf2", "sha1 0.10.5", "time 0.3.15", - "zstd 0.11.2+zstd.1.5.2", + "zstd", ] [[package]] @@ -4957,16 +4922,7 @@ version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "zstd-safe 5.0.2+zstd.1.5.2", -] - -[[package]] -name = "zstd" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" -dependencies = [ - "zstd-safe 7.0.0", + "zstd-safe", ] [[package]] @@ -4979,15 +4935,6 @@ dependencies = [ "zstd-sys", ] -[[package]] -name = "zstd-safe" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" -dependencies = [ - "zstd-sys", -] - [[package]] name = "zstd-sys" version = "2.0.9+zstd.1.5.5" diff --git a/crates/test_util/Cargo.toml b/crates/test_util/Cargo.toml index d9c69d26d..bea6e4d4e 100644 --- a/crates/test_util/Cargo.toml +++ b/crates/test_util/Cargo.toml @@ -3,7 +3,7 @@ name = "test_util" edition.workspace = true [dependencies] -async_zip = { workspace = true, features = ["full"] } +async_zip = { workspace = true, features = ["deflate"] } futures-lite.workspace = true once_cell.workspace = true serde = { workspace = true, features = ["derive"] } diff --git a/crates/test_util/src/lib.rs b/crates/test_util/src/lib.rs index f5c9b9de4..7522c81f7 100644 --- a/crates/test_util/src/lib.rs +++ b/crates/test_util/src/lib.rs @@ -51,8 +51,7 @@ pub async fn convert_zip_vvm(dir: impl AsRef) -> PathBuf { fs::create_dir_all(out_file_path.parent().unwrap()) .await .unwrap(); - let out_file = File::create(&out_file_path).await.unwrap(); - let mut writer = ZipFileWriter::with_tokio(out_file); + let mut writer = ZipFileWriter::new(vec![]); for entry in dir.read_dir().unwrap().flatten() { let entry_builder = ZipEntryBuilder::new( @@ -66,7 +65,8 @@ pub async fn convert_zip_vvm(dir: impl AsRef) -> PathBuf { entry_writer.write_all(&buf).await.unwrap(); entry_writer.close().await.unwrap(); } - writer.close().await.unwrap(); + let zip = writer.close().await.unwrap(); + fs::write(&out_file_path, zip).await.unwrap(); } out_file_path } diff --git a/crates/voicevox_core/Cargo.toml b/crates/voicevox_core/Cargo.toml index 8b1ab92f5..36d501b06 100644 --- a/crates/voicevox_core/Cargo.toml +++ b/crates/voicevox_core/Cargo.toml @@ -10,7 +10,7 @@ directml = ["onnxruntime/directml"] [dependencies] anyhow.workspace = true -async_zip = { workspace = true, features = ["full"] } +async_zip = { workspace = true, features = ["deflate"] } camino.workspace = true derive-getters.workspace = true derive-new.workspace = true diff --git a/crates/voicevox_core/src/voice_model.rs b/crates/voicevox_core/src/voice_model.rs index 52945bc50..77e7bd784 100644 --- a/crates/voicevox_core/src/voice_model.rs +++ b/crates/voicevox_core/src/voice_model.rs @@ -287,20 +287,24 @@ pub(crate) mod tokio { } #[derive(new)] - struct AsyncVvmEntryReader { - reader: async_zip::tokio::read::fs::ZipFileReader, + struct AsyncVvmEntryReader<'a> { + path: &'a Path, + reader: async_zip::base::read::mem::ZipFileReader, entry_map: HashMap, } - impl AsyncVvmEntryReader { - async fn open(path: &Path) -> LoadModelResult { - let reader = async_zip::tokio::read::fs::ZipFileReader::new(path) - .await - .map_err(|source| LoadModelError { - path: path.to_owned(), - context: LoadModelErrorKind::OpenZipFile, - source: Some(source.into()), - })?; + impl<'a> AsyncVvmEntryReader<'a> { + async fn open(path: &'a Path) -> LoadModelResult { + let reader = async { + let file = fs_err::tokio::read(path).await?; + async_zip::base::read::mem::ZipFileReader::new(file).await + } + .await + .map_err(|source| LoadModelError { + path: path.to_owned(), + context: LoadModelErrorKind::OpenZipFile, + source: Some(source.into()), + })?; let entry_map: HashMap<_, _> = reader .file() .entries() @@ -314,12 +318,12 @@ pub(crate) mod tokio { .enumerate() .map(|(i, (filename, entry))| (filename, AsyncVvmEntry { index: i, entry })) .collect(); - Ok(AsyncVvmEntryReader::new(reader, entry_map)) + Ok(AsyncVvmEntryReader::new(path, reader, entry_map)) } async fn read_vvm_json(&self, filename: &str) -> LoadModelResult { let bytes = self.read_vvm_entry(filename).await?; serde_json::from_slice(&bytes).map_err(|source| LoadModelError { - path: self.reader.path().to_owned(), + path: self.path.to_owned(), context: LoadModelErrorKind::ReadZipEntry { filename: filename.to_owned(), }, @@ -340,7 +344,7 @@ pub(crate) mod tokio { } .await .map_err(|source| LoadModelError { - path: self.reader.path().to_owned(), + path: self.path.to_owned(), context: LoadModelErrorKind::ReadZipEntry { filename: filename.to_owned(), },