Skip to content

Commit 84c783f

Browse files
fix(bundler): remove fallback for license_file (#8948)
* fix(bundler): remove fallback for license_file closes #8944 * Update .changes/bundler-license.md * use license only on rpm * change file * Update .changes/bundler-rpm-license.md --------- Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
1 parent 6e3bd4b commit 84c783f

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

.changes/bundler-license.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+
Fix NSIS installer always containing a license page even though `licenseFile` option is not set in the config.

.changes/bundler-rpm-license.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+
Don't fallback to `licenseFile` and use only `license` field when building RPM.

tooling/bundler/src/bundle/linux/rpm.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
4545

4646
info!(action = "Bundling"; "{} ({})", package_name, package_path.display());
4747

48-
let license = settings
49-
.license_file()
50-
.map(|l| std::fs::read_to_string(l).expect("failed to read license"))
51-
.unwrap_or_default();
48+
let license = settings.license().unwrap_or_default();
5249
let mut builder = rpm::PackageBuilder::new(name, version, &license, arch, summary)
5350
.epoch(epoch)
5451
.release(release);

tooling/bundler/src/bundle/settings.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -894,17 +894,14 @@ impl Settings {
894894
}
895895
}
896896

897+
/// Returns the bundle license.
898+
pub fn license(&self) -> Option<String> {
899+
self.bundle_settings.license.clone()
900+
}
901+
897902
/// Returns the bundle license file.
898903
pub fn license_file(&self) -> Option<PathBuf> {
899-
self.bundle_settings.license_file.clone().or_else(|| {
900-
self.bundle_settings.license.as_deref().map(|l| {
901-
let p = self
902-
.project_out_directory()
903-
.join(format!("{}-license", self.bundle_identifier()));
904-
std::fs::write(&p, l).expect("failed to write license to a temp file");
905-
p
906-
})
907-
})
904+
self.bundle_settings.license_file.clone()
908905
}
909906

910907
/// Returns the package's homepage URL, defaulting to "" if not defined.

0 commit comments

Comments
 (0)