fix(bundler): support macOS 10.13.6+ on notarization, closes #4549 (#4593)

This commit is contained in:
Lucas Fernandes Nogueira
2022-07-05 09:04:40 -03:00
committed by GitHub
parent b8cd2a7993
commit f7c59ecfc8
2 changed files with 20 additions and 11 deletions

View File

@@ -2,4 +2,4 @@
"tauri-bundler": patch
---
Ensure the notarization `RequestUUID` and `Status` parser works even if the altool output does not have a newline after it.
Ensure the notarization `RequestUUID` and `Status` parser works on macOS 10.13.6+.

View File

@@ -275,10 +275,13 @@ pub fn notarize(
.output_ok()
.context("failed to upload app to Apple's notarization servers.")?;
let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
stdout.push('\n');
// combine both stdout and stderr to support macOS below 10.15
let mut notarize_response = std::str::from_utf8(&output.stdout)?.to_string();
notarize_response.push('\n');
notarize_response.push_str(std::str::from_utf8(&output.stderr)?);
notarize_response.push('\n');
if let Some(uuid) = Regex::new(r"\nRequestUUID = (.+?)\n")?
.captures_iter(&stdout)
.captures_iter(&notarize_response)
.next()
{
info!("notarization started; waiting for Apple response...");
@@ -288,7 +291,11 @@ pub fn notarize(
staple_app(app_bundle_path.clone())?;
} else {
return Err(
anyhow::anyhow!("failed to parse RequestUUID from upload output. {}", stdout).into(),
anyhow::anyhow!(
"failed to parse RequestUUID from upload output. {}",
notarize_response
)
.into(),
);
}
@@ -326,10 +333,13 @@ fn get_notarization_status(
.output_ok();
if let Ok(output) = result {
let mut stdout = std::str::from_utf8(&output.stdout)?.to_string();
stdout.push('\n');
// combine both stdout and stderr to support macOS below 10.15
let mut notarize_status = std::str::from_utf8(&output.stdout)?.to_string();
notarize_status.push('\n');
notarize_status.push_str(std::str::from_utf8(&output.stderr)?);
notarize_status.push('\n');
if let Some(status) = Regex::new(r"\n *Status: (.+?)\n")?
.captures_iter(&stdout)
.captures_iter(&notarize_status)
.next()
{
let status = status[1].to_string();
@@ -339,7 +349,7 @@ fn get_notarization_status(
Err(
anyhow::anyhow!(format!(
"Apple failed to notarize your app. {}",
std::str::from_utf8(&output.stdout)?
notarize_status
))
.into(),
)
@@ -347,8 +357,7 @@ fn get_notarization_status(
Err(
anyhow::anyhow!(format!(
"Unknown notarize status {}. {}",
status,
std::str::from_utf8(&output.stdout)?
status, notarize_status
))
.into(),
)