mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-10-06 21:17:33 +03:00
parent
2c1c5ab13f
commit
621062246d
7
.changes/cli-drop-strip.md
Normal file
7
.changes/cli-drop-strip.md
Normal file
@ -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
|
@ -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(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user