Add option to skip craft configuration in mac crafter
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 20 Jun 2024 10:46:44 +0000 (18:46 +0800)
committerClaudio Cambra <developer@claudiocambra.com>
Mon, 8 Jul 2024 07:41:45 +0000 (15:41 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Craft/Build.swift [new file with mode: 0644]
admin/osx/mac-crafter/Sources/main.swift

diff --git a/admin/osx/mac-crafter/Sources/Craft/Build.swift b/admin/osx/mac-crafter/Sources/Craft/Build.swift
new file mode 100644 (file)
index 0000000..da7f9a9
--- /dev/null
@@ -0,0 +1,8 @@
+//
+//  File.swift
+//  
+//
+//  Created by Claudio Cambra on 20/6/24.
+//
+
+import Foundation
index 48280d3671e55fe3ea4c15532f09b5972bd0af93..7a40f0731576bff83fb2afdec7dbf2a96cbb9d10 100644 (file)
@@ -49,6 +49,9 @@ struct MacCrafter: ParsableCommand {
     @Option(name: [.long], help: "Skip code-signing dependency libraries and plugins.")
     var skipDependencyCodeSigning = false
 
+    @Option(name: [.long], help: "Skip craft configuration.")
+    var skipCraftConfiguration = false
+
     @Option(name: [.long], help: "The application's branded name.")
     var appName = "Nextcloud"
 
@@ -71,34 +74,36 @@ struct MacCrafter: ParsableCommand {
         try installIfMissing("python3", "brew install pyenv && pyenv install 3.12.4")
 
         print("Build tooling configured.")
-        print("Configuring KDE Craft.")
 
-        let craftMasterDir = "\(buildPath)/craftmaster"
         let fm = FileManager.default
-
-        if fm.fileExists(atPath: craftMasterDir) {
-            print("KDE Craft is already cloned.")
-        } else {
-            print("Cloning KDE Craft...")
-            shell("git clone --depth=1 \(craftMasterGitUrl) \(craftMasterDir)")
-        }
-
-        print("Configuring Nextcloud Desktop Client blueprints for KDE Craft...")
-
+        let craftMasterDir = "\(buildPath)/craftmaster"
         let craftMasterIni = "\(repoRootDir)/craftmaster.ini"
         let craftMasterPy = "\(craftMasterDir)/CraftMaster.py"
         let craftTarget = "macos-clang-arm64"
-        let craftCommand = 
+        let craftCommand =
             "python3 \(craftMasterPy) --config \(craftMasterIni) --target \(craftTarget) -c"
-        shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)")
 
-        print("Crafting KDE Craft...")
-        shell("\(craftCommand) craft")
+        if !skipCraftConfiguration {
+            print("Configuring KDE Craft.")
+
+            if fm.fileExists(atPath: craftMasterDir) {
+                print("KDE Craft is already cloned.")
+            } else {
+                print("Cloning KDE Craft...")
+                shell("git clone --depth=1 \(craftMasterGitUrl) \(craftMasterDir)")
+            }
+
+            print("Configuring Nextcloud Desktop Client blueprints for KDE Craft...")
+            shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)")
+
+            print("Crafting KDE Craft...")
+            shell("\(craftCommand) craft")
 
-        print("Crafting Nextcloud Desktop Client dependencies...")
-        shell("\(craftCommand) --install-deps nextcloud-client")
+            print("Crafting Nextcloud Desktop Client dependencies...")
+            shell("\(craftCommand) --install-deps nextcloud-client")
+        }
 
-        if !skipDependencyCodeSigning, let codeSignIdentity {
+        if !skipCraftConfiguration, !skipDependencyCodeSigning, let codeSignIdentity {
             print("Code-signing Nextcloud Desktop Client libraries and frameworks...")
 
             let craftLibDir = "\(buildPath)/\(craftTarget)/lib"
@@ -125,6 +130,7 @@ struct MacCrafter: ParsableCommand {
         shell("\(craftCommand) --src-dir \(repoRootDir) -i --buildtype \(buildType) nextcloud-client")
 
         if let codeSignIdentity {
+            print("Code-signing Nextcloud Desktop Client app bundle...")
             let craftBuildDir = "\(buildPath)/\(craftTarget)/build"
             let clientAppDir =
                 "\(craftBuildDir)/nextcloud-client/image-\(buildType)-master/\(appName).app"