Add proper codesigning for the Editor app for macOS
This commit is contained in:
@@ -192,6 +192,9 @@ namespace Flax.Deploy
|
||||
var ediotrBinariesPath = Path.Combine(appContentsPath, "Binaries/Editor/Mac", defaultEditorConfig);
|
||||
Utilities.DirectoryCopy(ediotrBinariesPath, appBinariesPath, true, true);
|
||||
|
||||
// Sign app resources
|
||||
CodeSign(appPath);
|
||||
|
||||
// Build a disk image
|
||||
var dmgPath = Path.Combine(Deployer.PackageOutputPath, "FlaxEditor.dmg");
|
||||
Log.Info(string.Empty);
|
||||
@@ -335,6 +338,7 @@ namespace Flax.Deploy
|
||||
Utilities.Run("strip", "FlaxEditor.dylib", null, dst, Utilities.RunOptions.None);
|
||||
Utilities.Run("strip", "libMoltenVK.dylib", null, dst, Utilities.RunOptions.None);
|
||||
|
||||
// Sign binaries
|
||||
CodeSign(Path.Combine(dst, "FlaxEditor"));
|
||||
CodeSign(Path.Combine(dst, "FlaxEditor.dylib"));
|
||||
CodeSign(Path.Combine(dst, "libMoltenVK.dylib"));
|
||||
|
||||
@@ -53,10 +53,15 @@ namespace Flax.Build.Platforms
|
||||
/// <param name="signIdenity">App code signing idenity name (from local Mac keychain). Use 'security find-identity -v -p codesigning' to list possible options.</param>
|
||||
public static void CodeSign(string file, string signIdenity)
|
||||
{
|
||||
if (!File.Exists(file))
|
||||
var isDirectory = Directory.Exists(file);
|
||||
if (!isDirectory && !File.Exists(file))
|
||||
throw new FileNotFoundException("Missing file to sign.", file);
|
||||
string cmdLine = string.Format("--force --timestamp -s \"{0}\" \"{1}\"", signIdenity, file);
|
||||
if (string.IsNullOrEmpty(Path.GetExtension(file)))
|
||||
if (isDirectory)
|
||||
{
|
||||
// Automatically sign contents
|
||||
cmdLine += " --deep";
|
||||
}
|
||||
{
|
||||
// Add entitlements file with some settings for the app execution
|
||||
cmdLine += string.Format(" --entitlements \"{0}\"", Path.Combine(Globals.EngineRoot, "Source/Platforms/Mac/Default.entitlements"));
|
||||
|
||||
Reference in New Issue
Block a user