better logs, don't run codesign if no assets are found (#4464)
This commit is contained in:
1 parent
f9f30263d3
commit
66c2dac38f
5 files changed
+119
-54
No files matched your search
@@ -337,19 +337,21 @@ pub(crate) fn extract_assets_from_file(path: impl AsRef<Path>) -> Result<AssetMa
|
||||
// Write the modified binary data back to the file
|
||||
file.write_all(new_data.as_ref())?;
|
||||
}
|
||||
|
||||
// Ensure the file is flushed to disk
|
||||
file.sync_all()
|
||||
.context("Failed to sync file after writing assets")?;
|
||||
|
||||
// If the file is a macos binary, we need to re-sign the modified binary
|
||||
if object_file.format() == object::BinaryFormat::MachO {
|
||||
if object_file.format() == object::BinaryFormat::MachO && !assets.is_empty() {
|
||||
// Spawn the codesign command to re-sign the binary
|
||||
let output = std::process::Command::new("codesign")
|
||||
.arg("--force")
|
||||
.arg("--sign")
|
||||
.arg("-") // Sign with an empty identity
|
||||
.arg(path)
|
||||
.output()?;
|
||||
.output()
|
||||
.context("Failed to run codesign - is `codesign` in your path?")?;
|
||||
|
||||
if !output.status.success() {
|
||||
bail!(
|
||||
|
||||
@@ -1086,7 +1086,7 @@ We checked the folders:
|
||||
.args(["find-identity", "-v", "-p", "codesigning"])
|
||||
.output()
|
||||
.await
|
||||
.context("Failed to run `security find-identity -v -p codesigning`")
|
||||
.context("Failed to run `security find-identity -v -p codesigning` - is `security` in your path?")
|
||||
.map(|e| {
|
||||
String::from_utf8(e.stdout)
|
||||
.context("Failed to parse `security find-identity -v -p codesigning`")
|
||||
@@ -1191,7 +1191,7 @@ We checked the folders:
|
||||
.arg(self.build.root_dir())
|
||||
.output()
|
||||
.await
|
||||
.context("Failed to codesign the app")?;
|
||||
.context("Failed to codesign the app - is `codesign` in your path?")?;
|
||||
|
||||
if !output.status.success() {
|
||||
bail!(
|
||||
|
||||
@@ -1874,7 +1874,7 @@ impl BuildRequest {
|
||||
// but is necessary for some linkers to work properly.
|
||||
// We ignore its error in case it doesn't recognize the architecture
|
||||
if self.linker_flavor() == LinkerFlavor::Darwin {
|
||||
if let Some(ranlib) = self.select_ranlib() {
|
||||
if let Some(ranlib) = Workspace::select_ranlib() {
|
||||
_ = Command::new(ranlib).arg(&out_ar_path).output().await;
|
||||
}
|
||||
}
|
||||
@@ -4607,13 +4607,6 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn select_ranlib(&self) -> Option<PathBuf> {
|
||||
// prefer the modern llvm-ranlib if they have it
|
||||
which::which("llvm-ranlib")
|
||||
.or_else(|_| which::which("ranlib"))
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Assemble a series of `--config key=value` arguments for the build command.
|
||||
///
|
||||
/// This adds adhoc profiles that dx uses to isolate builds from each other. Normally if you ran
|
||||
|
||||
Reference in new issue
Block a user