| 35 | } |
| 36 | |
| 37 | bool CodeSign(const String& file, const String& signIdentity) |
| 38 | { |
| 39 | if (signIdentity.IsEmpty()) |
| 40 | return false; |
| 41 | LOG(Info, "Code signing file: {}", file); |
| 42 | bool isDirectory = FileSystem::DirectoryExists(file); |
| 43 | if (!isDirectory && !FileSystem::FileExists(file)) |
| 44 | { |
| 45 | LOG(Error, "Missing file to sign: {}", file); |
| 46 | return true; |
| 47 | } |
| 48 | CreateProcessSettings procSettings; |
| 49 | procSettings.HiddenWindow = true; |
| 50 | procSettings.FileName = TEXT("/usr/bin/codesign"); |
| 51 | procSettings.Arguments = String::Format(TEXT("--force --timestamp -s \"{0}\" \"{1}\""), signIdentity, file); |
| 52 | if (isDirectory) |
| 53 | { |
| 54 | // Automatically sign contents |
| 55 | procSettings.Arguments += TEXT(" --deep"); |
| 56 | } |
| 57 | { |
| 58 | // Enable the hardened runtime |
| 59 | procSettings.Arguments += TEXT(" --options=runtime"); |
| 60 | } |
| 61 | { |
| 62 | // Add entitlements file with some settings for the app execution |
| 63 | procSettings.Arguments += String::Format(TEXT(" --entitlements \"{0}\""), Globals::StartupFolder / TEXT("Source/Platforms/Mac/Default.entitlements")); |
| 64 | } |
| 65 | const int32 result = Platform::CreateProcess(procSettings); |
| 66 | if (result != 0) |
| 67 | { |
| 68 | LOG(Error, "Failed to code sign '{1}' (result code: {0}). See log for more info.", result, file); |
| 69 | return true; |
| 70 | } |
| 71 | return false; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | MacPlatformTools::MacPlatformTools(ArchitectureType arch) |
no test coverage detected