Skip to content

Commit f5a59b9

Browse files
unknovvnakorovackiFabianLars
authored
fix(bundler): change build metadata verification into a warning (#12136)
Co-authored-by: akorovacki <andzej.korovacki@geniussports.com> Co-authored-by: Fabian-Lars <github@fabianlars.de>
1 parent 5432752 commit f5a59b9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changes/change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri-bundler': 'patch:bug'
3+
---
4+
5+
The NSIS bundler will now replace non-numeric build metadata with `0` instead of returning an error.

crates/tauri-bundler/src/bundle/windows/nsis/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn get_and_extract_nsis(nsis_toolset_path: &Path, _tauri_tools_path: &Path) -> c
131131
Ok(())
132132
}
133133

134-
fn add_build_number_if_needed(version_str: &str) -> anyhow::Result<String> {
134+
fn try_add_numeric_build_number(version_str: &str) -> anyhow::Result<String> {
135135
let version = semver::Version::parse(version_str).context("invalid app version")?;
136136
if !version.build.is_empty() {
137137
let build = version.build.parse::<u64>();
@@ -141,7 +141,10 @@ fn add_build_number_if_needed(version_str: &str) -> anyhow::Result<String> {
141141
version.major, version.minor, version.patch, version.build
142142
));
143143
} else {
144-
anyhow::bail!("optional build metadata in app version must be numeric-only");
144+
log::warn!(
145+
"Unable to parse version build metadata. Numeric value expected, received: `{}`. This will be replaced with `0` in `VIProductVersion` because Windows requires this field to be numeric.",
146+
version.build
147+
);
145148
}
146149
}
147150

@@ -150,6 +153,7 @@ fn add_build_number_if_needed(version_str: &str) -> anyhow::Result<String> {
150153
version.major, version.minor, version.patch,
151154
))
152155
}
156+
153157
fn build_nsis_app_installer(
154158
settings: &Settings,
155159
_nsis_toolset_path: &Path,
@@ -214,7 +218,7 @@ fn build_nsis_app_installer(
214218
data.insert("version", to_json(version));
215219
data.insert(
216220
"version_with_build",
217-
to_json(add_build_number_if_needed(version)?),
221+
to_json(try_add_numeric_build_number(version)?),
218222
);
219223

220224
data.insert(

0 commit comments

Comments
 (0)