Эх сурвалжийг харах

refactor: drop strip from build command. closes #3559 (#3863)

Jonas Kruckenberg 3 жил өмнө
parent
commit
621062246d

+ 7 - 0
.changes/cli-drop-strip.md

@@ -0,0 +1,7 @@
+---
+"cli.rs": patch
+---
+
+The CLI will not automatically run `strip` on release binaries anymore. Use the [`strip`] profile setting stabilized with Cargo 1.59.
+
+[`strip`]: https://doc.rust-lang.org/cargo/reference/profiles.html#strip

+ 0 - 36
tooling/cli/src/build.rs

@@ -208,11 +208,6 @@ pub fn command(options: Options) -> Result<()> {
     crate::interface::rust::build_project(runner, args).with_context(|| "failed to build app")?;
   }
 
-  #[cfg(unix)]
-  if !options.debug {
-    strip(&bin_path, &logger)?;
-  }
-
   if let Some(product_name) = config_.package.product_name.clone() {
     #[cfg(windows)]
     let product_path = out_dir.join(format!("{}.exe", product_name));
@@ -364,34 +359,3 @@ fn print_signed_updater_archive(output_paths: &[PathBuf]) -> crate::Result<()> {
   }
   Ok(())
 }
-
-// TODO: drop this when https://github.com/rust-lang/rust/issues/72110 is stabilized
-#[cfg(unix)]
-fn strip(path: &std::path::Path, logger: &Logger) -> crate::Result<()> {
-  use humansize::{file_size_opts, FileSize};
-
-  let filesize_before = std::fs::metadata(&path)
-    .with_context(|| "failed to get executable file size")?
-    .len();
-
-  // Strip the binary
-  Command::new("strip")
-    .arg(&path)
-    .stdout(std::process::Stdio::null())
-    .stderr(std::process::Stdio::null())
-    .status()
-    .with_context(|| "failed to execute strip")?;
-
-  let filesize_after = std::fs::metadata(&path)
-    .with_context(|| "failed to get executable file size")?
-    .len();
-
-  logger.log(format!(
-    "Binary stripped, size reduced by {}",
-    (filesize_before - filesize_after)
-      .file_size(file_size_opts::CONVENTIONAL)
-      .unwrap(),
-  ));
-
-  Ok(())
-}