Skip to content

Commit 5d6c188

Browse files
authored
chore: downloaded_version!の利用をやめる (#1200)
目的は二つ。一つは VOICEVOX/ort#17 の準備で、もう一つは #1199 の解決。 特に後者については、 #1198 の試みにすら牙を剥いてきているため先に解消し ておきたい。 Fixes: #1192 Fixes: #1199
1 parent b4766c4 commit 5d6c188

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/test_util/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license.workspace = true
88
libloading.workspace = true
99
serde = { workspace = true, features = ["derive"] }
1010
serde_json.workspace = true
11+
voicevox-ort.workspace = true # note: `download-binaries`と`copy-dylibs`だけ利用する
1112

1213
[build-dependencies]
1314
anyhow.workspace = true
@@ -22,7 +23,6 @@ serde = { workspace = true, features = ["derive"] }
2223
serde_json = { workspace = true, features = ["preserve_order"] }
2324
reqwest = { workspace = true, features = ["rustls-tls"] }
2425
tar.workspace = true
25-
voicevox-ort.workspace = true
2626
zip.workspace = true
2727

2828
[lints.rust]

crates/test_util/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn copy_onnxruntime(out_dir: &Path, dist: &Utf8Path) -> anyhow::Result<()> {
104104
.manifest_path(Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"))
105105
.exec()?;
106106

107-
const VERSION: &str = ort::downloaded_version!();
107+
const VERSION: &str = include_str!("../voicevox_core/onnxruntime-version.txt");
108108
let filename = &if cfg!(target_os = "linux") {
109109
format!("libonnxruntime.so.{VERSION}")
110110
} else if cfg!(any(target_os = "macos", target_os = "ios")) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.17.3

crates/voicevox_core/src/core/infer/runtimes/onnxruntime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ pub(crate) mod blocking {
377377
/// 推奨されるONNX Runtimeのバージョン。
378378
#[cfg(feature = "load-onnxruntime")]
379379
#[cfg_attr(docsrs, doc(cfg(feature = "load-onnxruntime")))]
380-
pub const LIB_VERSION: &'static str = ort::downloaded_version!();
380+
pub const LIB_VERSION: &'static str = include_str!("../../../../onnxruntime-version.txt");
381381

382382
/// [`LIB_NAME`]と[`LIB_VERSION`]からなる動的ライブラリのファイル名。
383383
///
@@ -577,7 +577,7 @@ pub(crate) mod nonblocking {
577577
#[cfg(feature = "load-onnxruntime")]
578578
#[cfg_attr(docsrs, doc(cfg(feature = "load-onnxruntime")))]
579579
// ブロッキング版と等しいことはテストで担保
580-
pub const LIB_VERSION: &'static str = ort::downloaded_version!();
580+
pub const LIB_VERSION: &'static str = include_str!("../../../../onnxruntime-version.txt");
581581

582582
/// [`LIB_NAME`]と[`LIB_VERSION`]からなる動的ライブラリのファイル名。
583583
///

crates/voicevox_core_c_api/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ tempfile.workspace = true
6262
test_util.workspace = true
6363
toml.workspace = true
6464
typetag.workspace = true
65-
voicevox-ort.workspace = true
6665

6766
[lints.rust]
6867
unsafe_code = "allow" # C APIのための操作

crates/voicevox_core_c_api/tests/e2e/log_mask.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ impl Utf8Output {
2323
}
2424

2525
pub(crate) fn mask_onnxruntime_filename(self) -> Self {
26+
const ONNXRUNTIME_VERSION: &str =
27+
include_str!("../../../voicevox_core/onnxruntime-version.txt");
2628
self.mask_stderr(
2729
static_regex!(regex::escape(
2830
const {
2931
if cfg!(windows) {
3032
r"onnxruntime.dll"
3133
} else if cfg!(target_os = "linux") {
32-
concatcp!("libonnxruntime.so.", ort::downloaded_version!())
34+
concatcp!("libonnxruntime.so.", ONNXRUNTIME_VERSION)
3335
} else if cfg!(target_os = "macos") {
34-
concatcp!("libonnxruntime.", ort::downloaded_version!(), ".dylib")
36+
concatcp!("libonnxruntime.", ONNXRUNTIME_VERSION, ".dylib")
3537
} else {
3638
panic!("unsupported")
3739
}

0 commit comments

Comments
 (0)