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>
This commit is contained in:
Amr Bashir 2024-02-22 19:56:22 +02:00 committed by GitHub
parent 6e3bd4b9f8
commit 84c783f6bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 13 deletions

View File

@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---
Fix NSIS installer always containing a license page even though `licenseFile` option is not set in the config.

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch:bug
---
Don't fallback to `licenseFile` and use only `license` field when building RPM.

View File

@ -45,10 +45,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
info!(action = "Bundling"; "{} ({})", package_name, package_path.display());
let license = settings
.license_file()
.map(|l| std::fs::read_to_string(l).expect("failed to read license"))
.unwrap_or_default();
let license = settings.license().unwrap_or_default();
let mut builder = rpm::PackageBuilder::new(name, version, &license, arch, summary)
.epoch(epoch)
.release(release);

View File

@ -894,17 +894,14 @@ impl Settings {
}
}
/// Returns the bundle license.
pub fn license(&self) -> Option<String> {
self.bundle_settings.license.clone()
}
/// Returns the bundle license file.
pub fn license_file(&self) -> Option<PathBuf> {
self.bundle_settings.license_file.clone().or_else(|| {
self.bundle_settings.license.as_deref().map(|l| {
let p = self
.project_out_directory()
.join(format!("{}-license", self.bundle_identifier()));
std::fs::write(&p, l).expect("failed to write license to a temp file");
p
})
})
self.bundle_settings.license_file.clone()
}
/// Returns the package's homepage URL, defaulting to "" if not defined.