Merge pull request #8445 from nextcloud/mac-crafter-improvements

Mac Crafter Improvements
This commit is contained in:
Iva Horn
2025-07-10 14:21:05 +02:00
committed by GitHub
2 changed files with 31 additions and 14 deletions

View File

@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Iva Horn
// SPDX-License-Identifier: GPL-2.0-or-later
enum MacCrafterError: Error, CustomStringConvertible {
case failedEnumeration(String)
case environmentError(String)
case gitError(String)
case craftError(String)
var description: String {
switch self {
case .failedEnumeration(let message):
return "Failed enumeration: \(message)"
case .environmentError(let message):
return "Environment: \(message)"
case .gitError(let message):
return "Git: \(message)"
case .craftError(let message):
return "Craft: \(message)"
}
}
}

View File

@ -9,13 +9,6 @@ import Foundation
struct Build: ParsableCommand {
static let configuration = CommandConfiguration(abstract: "Client building script")
enum MacCrafterError: Error {
case failedEnumeration(String)
case environmentError(String)
case gitError(String)
case craftError(String)
}
@Argument(help: "Path to the root directory of the Nextcloud Desktop Client git repository.")
var repoRootDir = "\(FileManager.default.currentDirectoryPath)/../../.."
@ -34,19 +27,19 @@ struct Build: ParsableCommand {
@Option(name: [.long], help: "Brew installation script URL.")
var brewInstallShUrl = "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
@Option(name: [.long], help: "CraftMaster git url.")
var craftMasterGitUrl = "https://invent.kde.org/packaging/craftmaster.git"
@Option(name: [.long], help: "CraftMaster Git URL.")
var craftMasterGitUrl = "https://invent.kde.org/ggadinger/craftmaster.git"
@Option(name: [.long], help: "KDE Craft blueprints git url.")
@Option(name: [.long], help: "KDE Craft blueprints Git URL.")
var kdeBlueprintsGitUrl = "https://github.com/nextcloud/craft-blueprints-kde.git"
@Option(name: [.long], help: "KDE Craft blueprints git ref/branch")
var kdeBlueprintsGitRef = "stable-3.17"
@Option(name: [.long], help: "Nextcloud Desktop Client craft blueprints git url.")
@Option(name: [.long], help: "Nextcloud Desktop Client craft blueprints Git URL.")
var clientBlueprintsGitUrl = "https://github.com/nextcloud/desktop-client-blueprints.git"
@Option(name: [.long], help: "Nextcloud Desktop Client craft blueprints git ref/branch.")
@Option(name: [.long], help: "Nextcloud Desktop Client craft blueprints Git ref/branch.")
var clientBlueprintsGitRef = "stable-3.17"
@Option(name: [.long], help: "Nextcloud Desktop Client craft blueprint name.")
@ -80,7 +73,7 @@ struct Build: ParsableCommand {
@Option(name: [.long], help: "Sparkle package signing key.")
var sparklePackageSignKey: String?
@Option(name: [.long], help: "Override server url.")
@Option(name: [.long], help: "Override server URL.")
var overrideServerUrl: String?
@Flag(help: "Reconfigure KDE Craft.")
@ -150,7 +143,7 @@ struct Build: ParsableCommand {
} else {
print("Cloning KDE Craft...")
guard shell("\(gitCloneCommand) \(craftMasterGitUrl) \(craftMasterDir)") == 0 else {
throw MacCrafterError.gitError("Error cloning craftmaster.")
throw MacCrafterError.gitError("The referenced CraftMaster repository could not be cloned.")
}
}
@ -242,6 +235,7 @@ struct Build: ParsableCommand {
guard shell(
"\(craftCommand) --buildtype \(buildType) \(buildMode) \(offlineMode) \(allOptionsString) \(craftBlueprintName)"
) == 0 else {
// Troubleshooting: This can happen because a CraftMaster repository was cloned which does not contain the commit defined in craftmaster.ini of this project due to use of customized forks.
throw MacCrafterError.craftError("Error crafting Nextcloud Desktop Client.")
}