]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Move packaging procedures into a single function in mac crafter
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 20 Sep 2024 10:45:40 +0000 (18:45 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 23 Sep 2024 08:30:10 +0000 (16:30 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Utils/Packaging.swift
admin/osx/mac-crafter/Sources/main.swift

index 135b097b8bd385834cf369dad123e09513e107db..2e851a021b85291e9188b8a61629edb5e3286b19 100644 (file)
@@ -71,3 +71,52 @@ func signSparklePackage(sparkleTbzPath: String, buildPath: String, signKey: Stri
         throw PackagingError.packageSparkleSignError("Could not sign Sparkle package tbz!")
     }
 }
+
+func packageAppBundle(
+    productPath: String,
+    buildPath: String,
+    craftTarget: String,
+    craftBlueprintName: String,
+    appName: String,
+    packageSigningId: String?,
+    appleId: String?,
+    applePassword: String?,
+    appleTeamId: String?,
+    sparklePackageSignKey: String?
+) throws {
+    print("Creating pkg file for client…")
+    let buildWorkPath = "\(buildPath)/\(craftTarget)/build/\(craftBlueprintName)/work/build"
+    let packagePath = try buildPackage(
+        appName: appName,
+        buildWorkPath: buildWorkPath,
+        productPath: productPath
+    )
+
+    if let packageSigningId {
+        print("Signing pkg with \(packageSigningId)…")
+        try signPackage(packagePath: packagePath, packageSigningId: packageSigningId)
+
+        if let appleId, let applePassword, let appleTeamId {
+            print("Notarising pkg with Apple ID \(appleId)…")
+            try notarisePackage(
+                packagePath: packagePath,
+                appleId: appleId,
+                applePassword: applePassword,
+                appleTeamId: appleTeamId
+            )
+        }
+    }
+
+    print("Creating Sparkle TBZ file…")
+    let sparklePackagePath =
+        try buildSparklePackage(packagePath: packagePath, buildPath: buildPath)
+
+    if let sparklePackageSignKey {
+        print("Signing Sparkle TBZ file…")
+        try signSparklePackage(
+            sparkleTbzPath: sparklePackagePath,
+            buildPath: buildPath,
+            signKey: sparklePackageSignKey
+        )
+    }
+}
index fada690b45e2a4438ca0d473f6270b63ccffc41c..87a23641e17f5aed72f4a3fc6125c6b6773cec0a 100644 (file)
@@ -228,41 +228,18 @@ struct Build: ParsableCommand {
         try fm.copyItem(atPath: clientAppDir, toPath: "\(productPath)/\(appName).app")
 
         if package {
-            print("Creating pkg file for client…")
-            let buildWorkPath = "\(clientBuildDir)/work/build"
-            let packagePath = try buildPackage(
+            try packageAppBundle(
+                productPath: productPath,
+                buildPath: buildPath,
+                craftTarget: craftTarget,
+                craftBlueprintName: craftBlueprintName,
                 appName: appName,
-                buildWorkPath: buildWorkPath,
-                productPath: productPath
+                packageSigningId: packageSigningId,
+                appleId: appleId,
+                applePassword: applePassword,
+                appleTeamId: appleTeamId,
+                sparklePackageSignKey: sparklePackageSignKey
             )
-
-            if let packageSigningId {
-                print("Signing pkg with \(packageSigningId)…")
-                try signPackage(packagePath: packagePath, packageSigningId: packageSigningId)
-
-                if let appleId, let applePassword, let appleTeamId {
-                    print("Notarising pkg with Apple ID \(appleId)…")
-                    try notarisePackage(
-                        packagePath: packagePath,
-                        appleId: appleId,
-                        applePassword: applePassword,
-                        appleTeamId: appleTeamId
-                    )
-                }
-            }
-
-            print("Creating Sparkle TBZ file…")
-            let sparklePackagePath =
-                try buildSparklePackage(packagePath: packagePath, buildPath: buildPath)
-
-            if let sparklePackageSignKey {
-                print("Signing Sparkle TBZ file…")
-                try signSparklePackage(
-                    sparkleTbzPath: sparklePackagePath,
-                    buildPath: buildPath,
-                    signKey: sparklePackageSignKey
-                )
-            }
         }
 
         print("Done!")