From b1ad91d7cbfa2c17e8ff36fa78431f3c71f5c8f2 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 20 Sep 2024 18:42:32 +0800 Subject: [PATCH] Create convenience function to convert architecture string to craft target string Signed-off-by: Claudio Cambra --- admin/osx/mac-crafter/Sources/Utils/Craft.swift | 17 +++++++++++++++++ admin/osx/mac-crafter/Sources/main.swift | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 admin/osx/mac-crafter/Sources/Utils/Craft.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 index 0000000000..738933f0e0 --- /dev/null +++ b/admin/osx/mac-crafter/Sources/Utils/Craft.swift @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2024 by Claudio Cambra + * + * 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" +} diff --git a/admin/osx/mac-crafter/Sources/main.swift b/admin/osx/mac-crafter/Sources/main.swift index 87bb3e354f..fada690b45 100644 --- a/admin/osx/mac-crafter/Sources/main.swift +++ b/admin/osx/mac-crafter/Sources/main.swift @@ -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"