Replace bool options with flags in mac crafter
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 24 Jun 2024 11:01:19 +0000 (19:01 +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/main.swift

index 7372ba2035b48ba264db8c8aaf104f018e462e69..c845bc4a0009b8db040de36397f56c445c159ef3 100644 (file)
@@ -51,34 +51,34 @@ struct MacCrafter: ParsableCommand {
     @Option(name: [.long], help: "Build type (e.g. Release, RelWithDebInfo, MinSizeRel, Debug).")
     var buildType = "RelWithDebInfo"
 
-    @Option(name: [.long], help: "Reconfigure craft.")
-    var reconfigureCraft = false
-
     @Option(name: [.long], help: "The application's branded name.")
     var appName = "Nextcloud"
 
-    @Option(name: [.long], help: "Build with Sparkle auto-updater.")
-    var buildAutoUpdater = true
-
     @Option(name: [.long], help: "Sparkle download URL.")
     var sparkleDownloadUrl =
         "https://github.com/sparkle-project/Sparkle/releases/download/1.27.3/Sparkle-1.27.3.tar.xz"
 
-    @Option(name: [.long], help: "Build App Bundle.")
-    var buildAppBundle = true
+    @Option(name: [.long], help: "Git clone command; include options such as depth.")
+    var gitCloneCommand = "git clone --depth=1"
+
+    @Flag(help: "Reconfigure KDE Craft.")
+    var reconfigureCraft = false
+
+    @Flag(help: "Build test suite.")
+    var buildTests = false
+
+    @Flag(name: [.long], help: "Do not build App Bundle.")
+    var disableAppBundle = false
 
-    @Option(name: [.long], help: "Build File Provider Module.")
+    @Flag(help: "Build File Provider Module.")
     var buildFileProviderModule = false
 
-    @Option(name: [.long], help: "Git clone command; include options such as depth.")
-    var gitCloneCommand = "git clone --depth=1"
+    @Flag(help: "Build without Sparkle auto-updater.")
+    var disableAutoUpdater = false
 
-    @Option(name: [.long], help: "Run a full rebuild.")
+    @Flag(help: "Run a full rebuild.")
     var fullRebuild = false
 
-    @Option(name: [.long], help: "Build test suite.")
-    var buildTests = true
-
     mutating func run() throws {
         print("Configuring build tooling.")
 
@@ -138,11 +138,11 @@ struct MacCrafter: ParsableCommand {
         var craftOptions = [
             "\(craftBlueprintName).srcDir=\(repoRootDir)",
             "\(craftBlueprintName).buildTests=\(buildTests ? "True" : "False")",
-            "\(craftBlueprintName).buildMacOSBundle=\(buildAppBundle ? "True" : "False")",
+            "\(craftBlueprintName).buildMacOSBundle=\(disableAppBundle ? "False" : "True")",
             "\(craftBlueprintName).buildFileProviderModule=\(buildFileProviderModule ? "True" : "False")"
         ]
 
-        if buildAutoUpdater {
+        if !disableAutoUpdater {
             print("Configuring Sparkle auto-updater.")
 
             let fm = FileManager.default
@@ -176,7 +176,7 @@ struct MacCrafter: ParsableCommand {
             }
         }
 
-        let buildMode = fullRebuild ? "-i" : buildAppBundle ? "--compile --install" : "--compile"
+        let buildMode = fullRebuild ? "-i" : disableAppBundle ? "compile" : "--compile --install"
         guard shell(
             "\(craftCommand) --buildtype \(buildType) \(buildMode) \(allOptionsString) \(craftBlueprintName)"
         ) == 0 else {