Skip to content

Commit 6210622

Browse files
refactor: drop strip from build command. closes #3559 (#3863)
1 parent 2c1c5ab commit 6210622

File tree

2 files changed

+7
-36
lines changed

2 files changed

+7
-36
lines changed

.changes/cli-drop-strip.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"cli.rs": patch
3+
---
4+
5+
The CLI will not automatically run `strip` on release binaries anymore. Use the [`strip`] profile setting stabilized with Cargo 1.59.
6+
7+
[`strip`]: https://doc.rust-lang.org/cargo/reference/profiles.html#strip

tooling/cli/src/build.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ pub fn command(options: Options) -> Result<()> {
208208
crate::interface::rust::build_project(runner, args).with_context(|| "failed to build app")?;
209209
}
210210

211-
#[cfg(unix)]
212-
if !options.debug {
213-
strip(&bin_path, &logger)?;
214-
}
215-
216211
if let Some(product_name) = config_.package.product_name.clone() {
217212
#[cfg(windows)]
218213
let product_path = out_dir.join(format!("{}.exe", product_name));
@@ -364,34 +359,3 @@ fn print_signed_updater_archive(output_paths: &[PathBuf]) -> crate::Result<()> {
364359
}
365360
Ok(())
366361
}
367-
368-
// TODO: drop this when https://github.com/rust-lang/rust/issues/72110 is stabilized
369-
#[cfg(unix)]
370-
fn strip(path: &std::path::Path, logger: &Logger) -> crate::Result<()> {
371-
use humansize::{file_size_opts, FileSize};
372-
373-
let filesize_before = std::fs::metadata(&path)
374-
.with_context(|| "failed to get executable file size")?
375-
.len();
376-
377-
// Strip the binary
378-
Command::new("strip")
379-
.arg(&path)
380-
.stdout(std::process::Stdio::null())
381-
.stderr(std::process::Stdio::null())
382-
.status()
383-
.with_context(|| "failed to execute strip")?;
384-
385-
let filesize_after = std::fs::metadata(&path)
386-
.with_context(|| "failed to get executable file size")?
387-
.len();
388-
389-
logger.log(format!(
390-
"Binary stripped, size reduced by {}",
391-
(filesize_before - filesize_after)
392-
.file_size(file_size_opts::CONVENTIONAL)
393-
.unwrap(),
394-
));
395-
396-
Ok(())
397-
}

0 commit comments

Comments
 (0)