diff --git a/Source/Tools/Flax.Build/Deploy/Deployer.cs b/Source/Tools/Flax.Build/Deploy/Deployer.cs index 6e5ccc390..4f12e769f 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployer.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployer.cs @@ -44,6 +44,12 @@ namespace Flax.Build /// [CommandLine("deployCertPass", "Certificate file password for binaries signing.")] public static string DeployCertPass; + + /// + /// Apple keychain profile name to use for app notarize action (installed locally). + /// + [CommandLine("deployKeychainProfile", "Apple keychain profile name to use for app notarize action (installed locally).")] + public static string DeployKeychainProfile; } } diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs index 78875c5d8..e1f2ab4e6 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs @@ -204,6 +204,16 @@ namespace Flax.Deploy Utilities.Run("hdiutil", $"create -srcFolder \"{appPath}\" -o \"{dmgPath}\"", null, null, Utilities.RunOptions.Default | Utilities.RunOptions.ThrowExceptionOnError); CodeSign(dmgPath); Log.Info("Output disk image size: " + Utilities.GetFileSize(dmgPath)); + + // Notarize disk image + if (!string.IsNullOrEmpty(Configuration.DeployKeychainProfile)) + { + Log.Info(string.Empty); + Log.Info("Notarizing disk image..."); + Utilities.Run("xcrun", $"notarytool submit \"{dmgPath}\" --wait --keychain-profile \"{Configuration.DeployKeychainProfile}\"", null, null, Utilities.RunOptions.Default | Utilities.RunOptions.ThrowExceptionOnError); + Utilities.Run("xcrun", $"stapler staple \"{dmgPath}\"", null, null, Utilities.RunOptions.Default | Utilities.RunOptions.ThrowExceptionOnError); + Log.Info("App notarized for macOS distribution!"); + } } // Compress diff --git a/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs b/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs index 8b614b6e4..4a8115fcd 100644 --- a/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs +++ b/Source/Tools/Flax.Build/Platforms/Mac/MacPlatform.cs @@ -62,6 +62,10 @@ namespace Flax.Build.Platforms // Automatically sign contents cmdLine += " --deep"; } + { + // Enable the hardened runtime + cmdLine += " --options=runtime"; + } { // Add entitlements file with some settings for the app execution cmdLine += string.Format(" --entitlements \"{0}\"", Path.Combine(Globals.EngineRoot, "Source/Platforms/Mac/Default.entitlements"));