Optional generation of Colors/Fonts/Images/Stringium extension Fix swiftlint warning
61 lines
1.6 KiB
Swift
61 lines
1.6 KiB
Swift
//
|
|
// FontsConfiguration+Runnable.swift
|
|
//
|
|
//
|
|
// Created by Thibaut Schmitt on 30/08/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension FontsConfiguration: Runnable {
|
|
|
|
func run(projectDirectory: String, force: Bool) {
|
|
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
|
Fonts.main(args)
|
|
}
|
|
|
|
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
|
var args = [String]()
|
|
|
|
if force {
|
|
args += ["-f"]
|
|
}
|
|
|
|
args += [
|
|
inputFile.prependIfRelativePath(projectDirectory),
|
|
"--static-members",
|
|
"\(staticMembersOptions)"
|
|
]
|
|
|
|
// Add optional parameters
|
|
[
|
|
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
|
("--extension-name", extensionName),
|
|
("--extension-name-ui-kit", extensionNameUIKit),
|
|
("--extension-suffix", extensionSuffix)
|
|
].forEach { argumentName, argumentValue in
|
|
if let argumentValue {
|
|
args += [
|
|
argumentName,
|
|
argumentValue
|
|
]
|
|
}
|
|
}
|
|
|
|
// Add infoPlist paths
|
|
if let infoPlistPaths {
|
|
let adjustedPlistPaths = infoPlistPaths
|
|
.split(separator: " ")
|
|
.map { String($0).prependIfRelativePath(projectDirectory) }
|
|
.joined(separator: " ")
|
|
|
|
args += [
|
|
"--info-plist-paths",
|
|
adjustedPlistPaths
|
|
]
|
|
}
|
|
|
|
return args
|
|
}
|
|
}
|