ソースを参照

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>
Amr Bashir 1 年間 前
コミット
84c783f6bc

+ 5 - 0
.changes/bundler-license.md

@@ -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.

+ 5 - 0
.changes/bundler-rpm-license.md

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

+ 1 - 4
tooling/bundler/src/bundle/linux/rpm.rs

@@ -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);

+ 6 - 9
tooling/bundler/src/bundle/settings.rs

@@ -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.