Use appName for packaging step in mac-crafter

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-09-19 21:08:00 +08:00
parent d195186332
commit b5ace6055b
2 changed files with 9 additions and 6 deletions

View file

@ -23,13 +23,12 @@ enum PackagingError: Error {
case packageSparkleSignError(String)
}
func buildPackage(buildWorkPath: String, productPath: String) throws -> String {
let projectName = "Nextcloud" // TODO: Get specific name
let packageFile = "\(projectName).pkg"
func buildPackage(appName: String, buildWorkPath: String, productPath: String) throws -> String {
let packageFile = "\(appName).pkg"
let sparkleFile = "\(packageFile).tbz"
let pkgprojPath = "\(buildWorkPath)/admin/osx/macosx.pkgproj"
guard shell("packagesutil --file \(pkgprojPath) set project name \(projectName)") == 0 else {
guard shell("packagesutil --file \(pkgprojPath) set project name \(appName)") == 0 else {
throw PackagingError.projectNameSettingError("Could not set project name in pkgproj!")
}
guard shell("packagesbuild -v --build-folder \(productPath) -F \(productPath) \(pkgprojPath)") == 0 else {

View file

@ -189,7 +189,7 @@ struct Build: ParsableCommand {
)
}
print("Crafting Nextcloud Desktop Client...")
print("Crafting \(appName) Desktop Client...")
let allOptionsString = craftOptions.map({ "--options \"\($0)\"" }).joined(separator: " ")
@ -231,7 +231,11 @@ struct Build: ParsableCommand {
if package {
print("Creating pkg file for client…")
let packagePath =
try buildPackage(buildWorkPath: buildWorkPath, productPath: productPath)
try buildPackage(
appName: appName,
buildWorkPath: buildWorkPath,
productPath: productPath
)
if let packageSigningId {
print("Signing pkg with \(packageSigningId)")