feat(mac-crafter): Add ability to codesign with an entitlements file

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2025-04-29 12:51:13 +08:00 committed by backportbot[bot]
parent 6c4a5e1190
commit 67d99a46d3

View File

@ -107,7 +107,9 @@ func saveCodesignEntitlements(target: String, path: String) throws {
}
func codesignClientAppBundle(
at clientAppDir: String, withCodeSignIdentity codeSignIdentity: String
at clientAppDir: String,
withCodeSignIdentity codeSignIdentity: String,
usingEntitlements entitlementsPath: String? = nil
) throws {
print("Code-signing Nextcloud Desktop Client libraries, frameworks and plugins...")
@ -197,5 +199,13 @@ func codesignClientAppBundle(
let mainExecutableName = String(appName.dropLast(".app".count))
let mainExecutablePath = "\(binariesDir)/\(mainExecutableName)"
try recursivelyCodesign(path: binariesDir, identity: codeSignIdentity, skip: [mainExecutablePath])
try codesign(identity: codeSignIdentity, path: mainExecutablePath)
var mainExecutableCodesignOptions = defaultCodesignOptions
if let entitlementsPath {
mainExecutableCodesignOptions =
"--timestamp --force --verbose=4 --options runtime --entitlements \"\(entitlementsPath)\""
}
try codesign(
identity: codeSignIdentity, path: mainExecutablePath, options: mainExecutableCodesignOptions
)
}