Add package command for mac crafter
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 20 Sep 2024 10:46:28 +0000 (18:46 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 24 Sep 2024 02:17:46 +0000 (10:17 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/main.swift

index 87a23641e17f5aed72f4a3fc6125c6b6773cec0a..de22b799e57bf7a6adaa50e8d4a2c3325364ff16 100644 (file)
@@ -260,14 +260,61 @@ struct Codesign: ParsableCommand {
     }
 }
 
+struct Package: ParsableCommand {
+    static let configuration = CommandConfiguration(abstract: "Packaging script for the client.")
+
+    @Option(name: [.short, .long], help: "Architecture.")
+    var arch = "arm64"
+
+    @Option(name: [.short, .long], help: "Path for build files to be written.")
+    var buildPath = "\(FileManager.default.currentDirectoryPath)/build"
+
+    @Option(name: [.short, .long], help: "Path for the final product to be put.")
+    var productPath = "\(FileManager.default.currentDirectoryPath)/product"
+
+    @Option(name: [.long], help: "Nextcloud Desktop Client craft blueprint name.")
+    var craftBlueprintName = "nextcloud-client"
+
+    @Option(name: [.long], help: "The application's branded name.")
+    var appName = "Nextcloud"
+
+    @Option(name: [.long], help: "Apple ID, used for notarisation.")
+    var appleId: String?
+
+    @Option(name: [.long], help: "Apple ID password, used for notarisation.")
+    var applePassword: String?
+
+    @Option(name: [.long], help: "Apple Team ID, used for notarisation.")
+    var appleTeamId: String?
+
+    @Option(name: [.long], help: "Apple package signing ID.")
+    var packageSigningId: String?
+
+    @Option(name: [.long], help: "Sparkle package signing key.")
+    var sparklePackageSignKey: String?
+
+    mutating func run() throws {
+        try packageAppBundle(
+            productPath: productPath,
+            buildPath: buildPath,
+            craftTarget: archToCraftTarget(arch),
+            craftBlueprintName: craftBlueprintName,
+            appName: appName,
+            packageSigningId: packageSigningId,
+            appleId: appleId,
+            applePassword: applePassword,
+            appleTeamId: appleTeamId,
+            sparklePackageSignKey: sparklePackageSignKey
+        )
+    }
+}
+
 struct MacCrafter: ParsableCommand {
     static let configuration = CommandConfiguration(
         abstract: "A tool to easily build a fully-functional Nextcloud Desktop Client for macOS.",
-        subcommands: [Build.self, Codesign.self],
+        subcommands: [Build.self, Codesign.self, Package.self],
         defaultSubcommand: Build.self
     )
-
-
 }
 
 MacCrafter.main()