allow codesigning any server backend on macos (#5085)

* allow codesigning any server backend on macos

* clippy
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-12-28 22:37:46 -05:00
1 parent 887a87dcc1
commit 02b62342ef
1 file changed
+20 -11
+20 -11
View File
@@ -4359,8 +4359,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
/// ///
/// This might include codesigning, zipping, creating an appimage, etc /// This might include codesigning, zipping, creating an appimage, etc
async fn assemble(&self, ctx: &BuildContext) -> Result<()> { async fn assemble(&self, ctx: &BuildContext) -> Result<()> {
match self.bundle { if let BundleFormat::Android = self.bundle {
BundleFormat::Android => {
ctx.status_running_gradle(); ctx.status_running_gradle();
// When the build mode is set to release and there is an Android signature configuration, use assembleRelease // When the build mode is set to release and there is an Android signature configuration, use assembleRelease
@@ -4384,14 +4383,14 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
); );
} }
} }
BundleFormat::MacOS | BundleFormat::Ios => {
if self.should_codesign {
ctx.status_codesigning();
self.codesign_apple().await?;
}
}
_ => {} // if the triple is a ios or macos target, we need to codesign the binary
if matches!(
self.triple.operating_system,
OperatingSystem::Darwin(_) | OperatingSystem::IOS(_)
) && self.should_codesign
{
self.codesign_apple(ctx).await?;
} }
Ok(()) Ok(())
@@ -5268,7 +5267,9 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
.collect() .collect()
} }
pub async fn codesign_apple(&self) -> Result<()> { pub async fn codesign_apple(&self, ctx: &BuildContext) -> Result<()> {
ctx.status_codesigning();
// We don't want to drop the entitlements file, until the end of the block, so we hoist it to this temporary. // We don't want to drop the entitlements file, until the end of the block, so we hoist it to this temporary.
let mut _saved_entitlements = None; let mut _saved_entitlements = None;
@@ -5303,6 +5304,14 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
app_dev_name app_dev_name
); );
// determine the target exe - the server and macos bundles are different
let target_exe = match self.bundle {
BundleFormat::MacOS => self.root_dir(),
BundleFormat::Ios => self.root_dir(),
BundleFormat::Server => self.main_exe(),
_ => bail!("Codesigning is only supported for MacOS and iOS bundles"),
};
// codesign the app // codesign the app
let output = Command::new("codesign") let output = Command::new("codesign")
.args([ .args([
@@ -5312,7 +5321,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
"--sign", "--sign",
app_dev_name, app_dev_name,
]) ])
.arg(self.root_dir()) .arg(target_exe)
.output() .output()
.await .await
.context("Failed to codesign the app - is `codesign` in your path?")?; .context("Failed to codesign the app - is `codesign` in your path?")?;