Fix codesigning of qtwebengine related helper app in mac crafter
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 11 Sep 2024 15:26:51 +0000 (23:26 +0800)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 12 Sep 2024 05:17:36 +0000 (05:17 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Utils/Codesign.swift

index 4e764d13807d6982e69eb8b2c7cde4fd3d156dca..696104813218419a373b12b907a46c8dfb7d4002 100644 (file)
@@ -69,17 +69,27 @@ func codesignClientAppBundle(
     print("Code-signing Nextcloud Desktop Client libraries, frameworks and plugins...")
 
     let clientContentsDir = "\(clientAppDir)/Contents"
+    let frameworksPath = "\(clientContentsDir)/Frameworks"
+    let pluginsPath = "\(clientContentsDir)/PlugIns"
 
-    try recursivelyCodesign(path: "\(clientContentsDir)/Frameworks", identity: codeSignIdentity)
-    try recursivelyCodesign(path: "\(clientContentsDir)/PlugIns", identity: codeSignIdentity)
+    try recursivelyCodesign(path: frameworksPath, identity: codeSignIdentity)
+    try recursivelyCodesign(path: pluginsPath, identity: codeSignIdentity)
     try recursivelyCodesign(path: "\(clientContentsDir)/Resources", identity: codeSignIdentity)
 
+    print("Code-signing QtWebEngineProcess...")
+    let qtWebEngineProcessPath =
+        "\(frameworksPath)/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app"
+    try codesign(identity: codeSignIdentity, path: qtWebEngineProcessPath)
+
+    print("Code-signing QtWebEngine...")
+    try codesign(identity: codeSignIdentity, path: "\(frameworksPath)/QtWebEngineCore.framework")
+
     // Time to fix notarisation issues.
     // Multiple components of the app will now have the get-task-allow entitlements.
     // We need to strip these out manually.
 
     print("Code-signing Sparkle autoupdater app (without entitlements)...")
-    let sparkleFrameworkPath = "\(clientContentsDir)/Frameworks/Sparkle.framework"
+    let sparkleFrameworkPath = "\(frameworksPath)/Sparkle.framework"
     try codesign(identity: codeSignIdentity,
                  path: "\(sparkleFrameworkPath)/Resources/Autoupdate.app/Contents/MacOS/*",
                  options: "--timestamp --force --verbose=4 --options runtime --deep")
@@ -90,9 +100,9 @@ func codesignClientAppBundle(
     print("Code-signing app extensions (removing get-task-allow entitlements)...")
     let fm = FileManager.default
     let appExtensionPaths =
-        try fm.contentsOfDirectory(atPath: "\(clientContentsDir)/PlugIns").filter(isAppExtension)
+        try fm.contentsOfDirectory(atPath: pluginsPath).filter(isAppExtension)
     for appExtension in appExtensionPaths {
-        let appExtensionPath = "\(clientContentsDir)/PlugIns/\(appExtension)"
+        let appExtensionPath = "\(pluginsPath)/\(appExtension)"
         let tmpEntitlementXmlPath =
             fm.temporaryDirectory.appendingPathComponent(UUID().uuidString).path.appending(".xml")
         try saveCodesignEntitlements(target: appExtensionPath, path: tmpEntitlementXmlPath)