Create convenience function to convert architecture string to craft target string
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 20 Sep 2024 10:42:32 +0000 (18:42 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 24 Sep 2024 02:17:45 +0000 (10:17 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
admin/osx/mac-crafter/Sources/Utils/Craft.swift [new file with mode: 0644]
admin/osx/mac-crafter/Sources/main.swift

diff --git a/admin/osx/mac-crafter/Sources/Utils/Craft.swift b/admin/osx/mac-crafter/Sources/Utils/Craft.swift
new file mode 100644 (file)
index 0000000..738933f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2024 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+func archToCraftTarget(_ arch: String) -> String {
+    return arch == "arm64" ? "macos-clang-arm64" : "macos-64-clang"
+}
index 87bb3e354fa1e1e6da53fb50dfe93ec49ed23de9..fada690b45e2a4438ca0d473f6270b63ccffc41c 100644 (file)
@@ -128,7 +128,7 @@ struct Build: ParsableCommand {
         let craftMasterDir = "\(buildPath)/craftmaster"
         let craftMasterIni = "\(repoRootDir)/craftmaster.ini"
         let craftMasterPy = "\(craftMasterDir)/CraftMaster.py"
-        let craftTarget = arch == "arm64" ? "macos-clang-arm64" : "macos-64-clang"
+        let craftTarget = archToCraftTarget(arch)
         let craftCommand =
             "python3 \(craftMasterPy) --config \(craftMasterIni) --target \(craftTarget) -c"